go to post Vitaliy Serdtsev · Jun 9 Let's suppose two different routines use one and the same chunk of code. From the object-oriented POV, a good decision is to have this chunk of code in a separate class and have both routines call it. However, whenever you call code outside of the routine as opposed to calling code in the same routine, some execution speed is lost. For reports churning through millions of transactions this lost speed might be noticeable. Any advice how to optimize specifically speed? What you are asking is very similar to Inline function in C. In Caché, macros and/or preprocessor directives are great for this role. Especially if the code size is small: ObjectScript Macros and the Macro Preprocessor In this case you will avoid the overhead of calling goto, do, job, xecute, etc. Example (procedure "swap") Class dc.a Extends %RegisteredObject { ClassMethod swap( ByRef x, ByRef y) { s tmp=x,x=y,y=tmp } /// d ##class(dc.a).Test() ClassMethod Test(N = {1e7}) { #define swap(%x,%y) s ##unique(new)=%x,%x=%y,%y=##unique(old) s a=3,b=7 s t=$zh f i=1:1:N s tmp=a,a=b,b=tmp w "inline procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N d swap w "just a procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N $$$swap(a,b) w "macros procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N d ..swap(.a,.b) w "class method",?20,$zh-t," sec",! swap() s tmp=a,a=b,b=tmp } } ;dc.a.1 ;Generated for class dc.a. Do NOT edit. 09.06.2025 00:00:00PM ;;00000000;dc.a ; Test(N) methodimpl { s:'($d(N)#2) N=1e7 s a=3,b=7 s t=$zh f i=1:1:N s tmp=a,a=b,b=tmp w "inline procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N d swap w "just a procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N s %mmmu1=a,a=b,b=%mmmu1 w "macros procedure",?20,$zh-t," sec",! s t=$zh f i=1:1:N d ..swap(.a,.b) w "class method",?20,$zh-t," sec",! swap() s tmp=a,a=b,b=tmp } swap(x,y) methodimpl { s tmp=x,x=y,y=tmp } When implementing a sorting algorithm doing lots of swaps, this can increase the execution speed. PS: And yes, avoid passing input/output parameters and class methods due to the high overhead of calling them.
go to post Vitaliy Serdtsev · Jun 6 CREATE FUNCTION inLike(str VARCHAR(50), lstLike VARCHAR(50)) RETURNS BIT PROCEDURE LANGUAGE OBJECTSCRIPT { set res = 0, ptr = 0 while $listnext(lstLike,ptr,v) { &sql(select case when :str like :v then 1 else 0 end into :like) if like { set res = 1 quit } } quit res }Usage: select * from CustomersTable where inLike(CustomerName,$LISTBUILD('%Mark%','%John%','%an%'))=1
go to post Vitaliy Serdtsev · Jun 4 In any unclear situation, when incorrect data is returned, two things need to be done first: rebuild the indexes and tune tables: Kyle Lists Common Problems and Their Solutions: 7 Reasons A Query Returns No Data The One Query Performance Trick You NEED to Know? Tune Table! Since you have a large range of values, I would pay attention to INDEXNULLMARKER: Indexing a NULL
go to post Vitaliy Serdtsev · Jun 4 Has it worked before? If so, then most likely there were some changes in the OS at the file/registry level. First, try to run on the command line (see Registering Files): >cd D:\DHC\DEVSOFTWARE\ENSEMBLE\BIN D:\DHC\DEVSOFTWARE\ENSEMBLE\BIN>RegFiles.bat ALL If it doesn't help, try select Repair to repair problems with the instance such as missing or corrupt files or registry entries: Reinstalling or Uninstalling Caché
go to post Vitaliy Serdtsev · May 21 Great, that's something. Can you show the exact query text and the class source code for the SQLUser.PA_Person table?
go to post Vitaliy Serdtsev · May 21 In your question, yesterday you published the mgstat results for slow and fast servers. Now it looks like you've deleted this data, since I can't see it. Could you return them? I noticed a very significant difference there for two parameters, namely routinebuffers and numberofcpus.
go to post Vitaliy Serdtsev · May 21 Try to do my example and report the results. Also, try to run your query not in win sql, but in the InterSystems Management Portal.
go to post Vitaliy Serdtsev · May 21 Class dc.a Extends %Persistent { Property s As %String; ClassMethod Test() { &sql(truncate table dc.a) &sql(insert into dc.a(s) values('Hello')) d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.a").%Display() w ! &sql(update dc.a set s=s||' world' where %ID=1) d ##class(%SQL.Statement).%ExecDirect(,"select * from dc.a").%Display() } } USER>d ##class(dc.a).Test() ID s 1 Hello 1 Rows(s) Affected ID s 1 Hello world 1 Rows(s) AffectedCan we see the error number and error text?
go to post Vitaliy Serdtsev · May 19 If that's correct, is there a way to configure the JDBC connection to interpret this data using EUC-KR encoding? No: Caché JDBC Connection Properties But even if JDBC had encoding settings, it wouldn't help you, because the 8-bit version of Caché doesn't support Korean and doesn't know anything about EUC-KR/KSC5601. PS: I would consider switching to the Unicode version of Caché, which already has support for the Korean language.
go to post Vitaliy Serdtsev · May 16 However, when I access the data through the Cache Management Portal, Cache Terminal, VSC, or IntelliJ, the Korean text appears broken, as I mentioned earlier. Give an example of what you see in globals in the InterSystems Management Portal: System Explorer > Globals Since you have an 8-bit version and not Unicode, you probably won't see the hieroglyphs (최봉남), but rather something similar to (ÃÖºÀ³²). This is not corrupted data, just a string stored in KSC5601/EUC-KR encoding. From Caché terminal (Unicode version, locale = korw (Korean, Korea, Unicode)): USER>w $zcvt("최봉남","O","KSC5601") ÃÖºÀ³² USER>w $zcvt("ÃÖºÀ³²","I","KSC5601") 최봉남The same on Java: System.out.println(new String("최봉남".getBytes(Charset.forName("EUC-KR")), Charset.forName("ISO-8859-1"))); // ÃÖºÀ³² System.out.println(new String("ÃÖºÀ³²".getBytes(StandardCharsets.ISO_8859_1), Charset.forName("EUC-KR"))); // 최봉남
go to post Vitaliy Serdtsev · May 15 When I run below code in the Cache terminal, it returns 0, so it seems to be the 8-bit version. That's what I thought. I have the Unicode version installed, the rusw locale, and there are no problems at all. Example Class dc.a Extends %Persistent { Index is On s; Property s As %String; /// d ##class(dc.a).Test() ClassMethod Test() { s t=..%New() s t.s="최봉남" d t.%Save() } } From any JDBC client: select * from dc.a Result: ID s 1 최봉남 (When I check from the Management Portal, it shows as Latin1. If there's a more accurate way to verify this, please let me know.) In SMP: System Administration > Configuration > National Language Settings > Locale DefinitionsYou should have something like kor8, enu8, eng8, etc.
go to post Vitaliy Serdtsev · May 15 Which version of Caché are you using: 8-bit or Unicode? What locale is set by default?
go to post Vitaliy Serdtsev · Apr 24 It seems that adding to favorites via the management portal itself has also stopped working. Interestingly, there is no error in this case. Add to favorites in Management Portal
go to post Vitaliy Serdtsev · Apr 18 IRIS 2025.1.CE: the error is the same. Why the %Library.EntityProjectionUtil class is missing in the system is a good question for developers.
go to post Vitaliy Serdtsev · Apr 18 ##class(%DynamicObject).%FromOref() Is this what you were looking for?
go to post Vitaliy Serdtsev · Apr 18 Script Command Arguments: Note: Any ASCII (extended) character except NUL (000) can be produced via <ddd> where ddd is the decimal value of the character. USER>w $a("<") 60 USER>w $a(">") 62So, something similar is needed: echo: off send: s V=4 I (V<60>48!(V<62>57))&&(V<60>65!(V<62>90))&&(V<60>97!(V<62>122)) W A,?10,G,?30,B,! wait for:USER>
go to post Vitaliy Serdtsev · Apr 15 I join the question @Ashok Kumar T. I did not find DP-422635 and DP-424156 among the published ones: InterSystems IRIS® Change Notes (2024.1.3) InterSystems IRIS® Upgrade Checklist (2024.2) InterSystems IRIS® Upgrade Checklist (2024.3) InterSystems IRIS® Upgrade Checklist (2025.1) In addition, there are no warnings in the documentation that these methods are deprecated and no longer work: Calling Functions and Procedures from Python
go to post Vitaliy Serdtsev · Apr 14 See Run an ObjectScript Routine from Embedded Python2024.1 Example: USER>d $system.Python.Shell() >>> iris.routine("fnString^IRISPython",14) 'Hello 14' >>>
go to post Vitaliy Serdtsev · Mar 31 Initially, the question was asked in relation to Caché or/and Ensemble 2018.1, but not to IRIS.