Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.
This repository was archived by the owner on Jul 10, 2019. It is now read-only.

Big data - Execution timeout #5

@lkrocek

Description

@lkrocek

https://github.com/rolandoislas/BrightWebSocket/blob/15d9b4bb36ef0741d8743d50b99921520fa7a33e/src/web_socket_client/WebSocketClient.brs#L247

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions