Ignore:
Timestamp:
Nov 10, 2009, 11:22:30 PM (16 years ago)
Author:
[email protected]
Message:

Faster Math.random, based on GameRand.

Reviewed by Gavin "avGni arBalroguch" Barraclough.

SunSpider says 1.4% faster.

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSGlobalData.h: Use an object to track random number generation

state, initialized to the current time.

  • runtime/MathObject.cpp:

(JSC::MathObject::MathObject):
(JSC::mathProtoFuncRandom): Use the new hotness.

  • runtime/WeakRandom.h: Added.

(JSC::WeakRandom::WeakRandom):
(JSC::WeakRandom::get):
(JSC::WeakRandom::advance): The new hotness.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r50711 r50789  
    3939#include "SmallStrings.h"
    4040#include "TimeoutChecker.h"
     41#include "WeakRandom.h"
    4142#include <wtf/Forward.h>
    4243#include <wtf/HashMap.h>
     
    179180        UString cachedDateString;
    180181        double cachedDateStringValue;
     182       
     183        WeakRandom weakRandom;
    181184
    182185#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.