performance

How to get microsecond timings in JavaScript since Spectre and Meltdown

非 Y 不嫁゛ 提交于 2021-02-07 06:34:07
问题 The situation When writing high-performance JavaScript code, the standard profiling tools offered by Chrome et al are not always sufficient. They only seem to offer function-level granularity and it can be quite time-consuming to drill down and find the information I need. In .NET the StopWatch class gives me exactly what I need: sub-microsecond resolution timing of arbitrary pieces of code. For JavaScript performance.now() used to be a pretty good way to measure performance, but in response

Is it better to declare a local inside or outside a loop? [duplicate]

自古美人都是妖i 提交于 2021-02-07 06:29:05
问题 This question already has an answer here : In Lua, should I define a variable every iteration of a loop or before the loop? (1 answer) Closed 4 years ago . I am used to do this: do local a for i=1,1000000 do a = <some expression> <...> --do something with a end end instead of for i=1,1000000 do local a = <some expression> <...> --do something with a end My reasoning is that creating a local variable 1000000 times is less efficient than creating it just once and reuse it on each iteration. My

What's the fastest way to do a right bit rotation/circular shift on a byte array

[亡魂溺海] 提交于 2021-02-07 05:45:21
问题 If I have the array: {01101111,11110000,00001111} // {111, 240, 15} The result for a 1 bit shift is: {10110111,11111000,00000111} // {183, 248, 7} The array size is not fixed, and the shifting will be from 1 to 7 inclusive. Currently I have the following code (which works fine): private static void shiftBitsRight(byte[] bytes, final int rightShifts) { assert rightShifts >= 1 && rightShifts <= 7; final int leftShifts = 8 - rightShifts; byte previousByte = bytes[0]; // keep the byte before

Script timed out before returning headers: php.fastcgi

删除回忆录丶 提交于 2021-02-07 03:43:04
问题 After about 90 seconds I see this error in my apache error log. I'm assusming I need to increase a setting in PHP but I'm not sure which one to change. Is there one setting I can increase to clear this error? 回答1: Find in your php.ini file something like this: ; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 600 ; Maximum amount of time each script may spend parsing request

Script timed out before returning headers: php.fastcgi

与世无争的帅哥 提交于 2021-02-07 03:42:45
问题 After about 90 seconds I see this error in my apache error log. I'm assusming I need to increase a setting in PHP but I'm not sure which one to change. Is there one setting I can increase to clear this error? 回答1: Find in your php.ini file something like this: ; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 600 ; Maximum amount of time each script may spend parsing request

Go 1.13 RSS keeps on increasing, suspected scavenging issue

元气小坏坏 提交于 2021-02-07 03:41:13
问题 We are experiencing RSS that keeps on increasing in one of our Go service. We are suspecting it's due to scavenger not returning memory to OS properly (or OS not taking back the memory due to use of MADV_FREE). Checked via pprof, no memory leak detected. We tried some experiment with the following simple Go program: Go version: go1.13.4 linux/amd64 (tried with go1.13.1 too) package main import ( "fmt" "time" ) func allocate(s int) { a := make([]byte, s * 1024 * 1024) for i := 0;i < len(a); i

Vector or MutableList / ListBuffer for performance

落爺英雄遲暮 提交于 2021-02-07 03:30:36
问题 Apologies if this is a duplicate - I did a few searches and didn't quite find what I need. We have a performance critical piece of our application that converts a Play 2.0 Enumerator (can be thought of as a Stream ) of incoming data to a List (or similar). We will use the fold method on Enumerator and the question is what will be the most performant way to do it. (I will use Stream instead of Enumerator in the code, but the idea should be the same.) val incoming: Stream[Int] = ??? val result:

Vector or MutableList / ListBuffer for performance

回眸只為那壹抹淺笑 提交于 2021-02-07 03:29:05
问题 Apologies if this is a duplicate - I did a few searches and didn't quite find what I need. We have a performance critical piece of our application that converts a Play 2.0 Enumerator (can be thought of as a Stream ) of incoming data to a List (or similar). We will use the fold method on Enumerator and the question is what will be the most performant way to do it. (I will use Stream instead of Enumerator in the code, but the idea should be the same.) val incoming: Stream[Int] = ??? val result:

Access stacktraces with good performance?

余生长醉 提交于 2021-02-07 03:28:07
问题 We recently applied a caching solution that is used by almost all application modules/components (approx. 50 projects). To get a better understanding which cache operations are executed on the different system "places", we added logging for the currently performed cache operations including a stack trace to exactly know what triggered the cache operation. Our current approach looks like this: We take the stack trace from new Throwable(), filter the irrelevant lines and log the remaining stack

Access stacktraces with good performance?

◇◆丶佛笑我妖孽 提交于 2021-02-07 03:25:47
问题 We recently applied a caching solution that is used by almost all application modules/components (approx. 50 projects). To get a better understanding which cache operations are executed on the different system "places", we added logging for the currently performed cache operations including a stack trace to exactly know what triggered the cache operation. Our current approach looks like this: We take the stack trace from new Throwable(), filter the irrelevant lines and log the remaining stack