Comments (1)
On further investigation, the slowdown is almost surely due to taking the slow-path when we shouldn't, rather than due to the guard itself introducing slowness; that is, the guard is returning true when it shouldn't. The fromIntegral
function has modular-arithmetic semantics for all the built-in Int
/Word
types, and this is causing things to go haywire.
For example, when a ~ Int64
we have that fromIntegral(maxBound::Word64) == -1
, which in turn means n0 > -1
will always return true (since we've already filtered out the negative numbers), thus we'll always take the slow-pathβ even though in truth every single non-negative 'Int64' can be perfectly well embedded into Word64
, so there's no actual risk of the fast-path breaking.
The easiest fix is to change the guard to toInteger n0 > toInteger (maxBound::Word64)
. If the guard itself seems to be introducing the slowness, then we can do some bit-bashing to speed that up.
from bytestring-lexing.
Related Issues (13)
- Get TravisCI to work
- Add fast lexers for Integer and Natural
- Add support for partial input HOT 5
- CI failing for GHC 9.0.1 HOT 3
- Update instructions for running tests HOT 1
- Consider integrating @juspay's fork
- Improve coverage
- Move benchmarks to the main cabal file
- Native support for bytestring >=0.11
- Build failure in v0.3.0 with GHC 7.10.3 HOT 7
- Support GHC-9.6 HOT 1
- cannot run benchmarks HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bytestring-lexing.