This repository was archived by the owner on Jul 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
This repository was archived by the owner on Jul 10, 2019. It is now read-only.
Big data - Execution timeout #5
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
if I create a big json data and convert it into string my app crash because Execution timeout, I was debugging for it and figured out there is a lot of work with roByteArray which is expensive for performance, not sure if change to work with string instead will improve it but at least there is 1 loop(for) which contains next 2 loops(for) it could be merged into one, here is some test:
function time_test_orig(test_string as string) as dynamic
_FRAME_SIZE = 1024
timer = createObject("roTimespan")
timer.mark()
' bytes = createObject("roByteArray")
' bytes.fromAsciiString(test_string)
frame_count = bytes.count() \ _FRAME_SIZE
if bytes.count() mod _FRAME_SIZE <> 0 or frame_count = 0
frame_count++
end if
max = bytes.count() - 1
for frame_index = 0 to frame_count - 1
payload = createObject("roByteArray")
for byte_index = frame_index * _FRAME_SIZE to max
payload.push(bytes[byte_index])
end for
end for
' ?"[TIME]:";timer.TotalMilliseconds()
return timer.TotalMilliseconds()
end function
then I did call, to make more relative data I will call it many times to make average time:
t = 0
repeat = 50
test_string = "ásdaas{}asd asd asxcvxcv dsf;'ad][][a{}asda]xcvvdfedzsfdsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaassssssssssssssssssssssssssssssssssssssssssssddddddddddddddddddddddddddddddddddddddddddddddfdsfddfgdfggt546545465434yrtyrty5676578667tygh df hdgfh dhgf yhdgfhrt 2qtt 345 344rdfgdfghdgf sfaasdasdasxxcvxcvxc'"
test_string += test_string + test_string + test_string + test_string
test_string += test_string + test_string' + test_string + test_string
for i = 0 to repeat
t += time_test(test_string)
end for
?"OVERALL: "; t/repeat; len(test_string)
also would be nice to write down some unit tests in this project. There are 2 unit tests components at least for brightscript.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request