Hi there,

Anyone knows what is happening ?

load 'jmf'
load 'dates'

9!:11 (20)

NB. Create/Map the file, fills with zero
Test1 =: 3 : 0
        BEG =: tsrep 6!:0 ''
        unmapall_jmf_ ''
        createjmf_jmf_ 'c:\mic.dat';126144000
        map_jmf_ 'up';'c:\mic.dat';'';0
        up =: 31536000 # 0
        commit_jmf_ 'up'
        unmap_jmf_ 'up'
        END =: tsrep 6!:0 ''
        smoutput (": (END - BEG) % 1000) , ' seconds to execute'
        0 $ 0
)

NB. Map the file, modify 86400 values
Test2 =: 3 : 0
        BEG =: tsrep 6!:0 ''
        unmapall_jmf_ ''
        map_jmf_ 'up1';'c:\mic.dat';'';0
        up1 =: (47364) (12000000 + i. 86400) } up1
        commit_jmf_ 'up1'
        unmap_jmf_ 'up1'
        END =: tsrep 6!:0 ''
        smoutput (": (END - BEG) % 1000) , ' seconds to execute'
        0 $ 0
)

commit_jmf_ =: 3 : 0
n=. <fullname y.
row=. ({."1 mappings)i.n NB. row in mappings
if. row=#mappings do. 1 return. end.  NB. not mapped
m=. row{mappings
'fh mh fad had'=. 4{.3}.m
FlushViewOfFileR fad;0
)


I execute Test1, it takes 1.5 seconds.

I execute Test2, it takes 6.21 seconds.

If I execute Test2 again, it takes 0.031 seconds.

If I reboot the computer, reopen J, and execute Test2 directly, it takes 0.031 seconds...

Test2 is only modifying 86400 values out of 31536000... Why it takes 6.21 seconds the first time?

Even if I modify the value to amend and the range of index, it is still extremely fast after the first Test2 execution.

Thank you,

Simon

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to