Author: nextgens
Date: 2007-03-23 17:52:54 +0000 (Fri, 23 Mar 2007)
New Revision: 12284
Modified:
trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
Log:
Update PARALLEL_DECODES according to the number of available processors.
Modified: trunk/freenet/src/freenet/client/StandardOnionFECCodec.java
===================================================================
--- trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2007-03-23
15:35:28 UTC (rev 12283)
+++ trunk/freenet/src/freenet/client/StandardOnionFECCodec.java 2007-03-23
17:52:54 UTC (rev 12284)
@@ -79,9 +79,16 @@
private static int MAX_CACHED_CODECS = 8;
// REDFLAG: Optimal stripe size? Smaller => less memory usage, but more
JNI overhead
private static int STRIPE_SIZE = 4096;
- // REDFLAG: Make this configurable, maybe make it depend on # CPUs
- private static int PARALLEL_DECODES = 1;
+ private static int PARALLEL_DECODES;
+ static {
+ int nbAvailableProcessors =
Runtime.getRuntime().availableProcessors();
+ if(nbAvailableProcessors > 1)
+ PARALLEL_DECODES = nbAvailableProcessors - 1;
+ else
+ PARALLEL_DECODES = 1;
+ }
+
private static class MyKey {
/** Number of input blocks */
int k;