Note that there are some explanatory texts on larger screens.

plurals
  1. POCode runs extremely slowly inside Google App Engine
    text
    copied!<p>I'm doing some experiments with doing work (in this case, a MD5 brute-forcer) on Google App Engine using the MapReduce framework. </p> <p>I'm having an issue where the code runs extremely slowly inside GAE, even just using the development server</p> <p>This code <a href="https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/mapreduce/HashMapper.java" rel="nofollow">https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/mapreduce/HashMapper.java</a> will only handle approximately 4,000 hashes per second (this is time inside a single call to map(), and there is no google app engine apis used at all inside it). </p> <p>I took the code outside and ran it standalone - <a href="https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/StandaloneTest.java" rel="nofollow">https://github.com/jordan-thoms/Hash/blob/f982956f41313cd4fe3b5105aee21ea11bd3af16/src/nz/net/thoms/hash/StandaloneTest.java</a> , and that version will do over 1 million per second. It's the central loop that's running slower, which is strange since none of that code has anything to do with the google app engine.</p> <p>I've tried running profilers on the Google App engine code, but I haven't found anything useful - seems to be a ton of calls to checkRestricted() and things like that though. I tried removing the security manager </p> <p>Even this simple code:</p> <pre><code> int i; for (i=0; i&lt; 1000000; i++) { i += 2; i += (int) Math.sin(i * (i + (int) System.currentTimeMillis())); } long enda = System.currentTimeMillis(); System.out.println("took " + (enda - starta) + " i:" + i); </code></pre> <p>Runs in 117 ms if I put it in a normal program, and in over 400ms inside a servlet in the developer mode, on the same processor.</p> <p>(Interestingly, the mapper gets about 60,000 hashes done per second on the production Google App Engine. So a lot faster, but still very slow compared to a standalone program)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload