Closed GoogleCodeExporter closed 9 years ago
Within Google, > 50% of all Ranges are either Integer or Long.
There may be some sense in providing special support for long-valued ranges
(and probably not bothering with int anymore these days). *Ideally*,
Range.open() and friends would just have long-valued overloads and you would
get a LongRange that extends Range<Long>. (Problem: anyone currently passing
(long, Long) would suffer a compilation breakage.)
And that class would have primitive versions of most methods, a primitive-based
implementation, and an asSet() method that gives you a ContiguousSet without
needing to pass in DiscreteDomain.longs().
All in all, this could get pretty hairy and I'm not sure it's the right place
to spend time right now; I'm just updating this to sketch out what it might
look like _if_ we did it.
Original comment by kevinb@google.com
on 14 Apr 2014 at 10:38
Uhwell, if you have `LongRange`, how far away is `IntRange`.
FWIW, I took the plunge in my project and developed a custom, limited purpose
`IntRange`. I still use a `RangeMap`, so I have a `.asGuavaRange()` method as
well.
But this simple change made speed go up by 60% and memory usage go down by 70%!
Yes, most memory was consumed by `Pattern` calling `.charAt()`, which in my
implementation starts to check whether the current character range
`.contains()` the queried character index... It has managed to dwarf `char[]`
memory usage, which is quite contradictory!
Original comment by fgalie...@gmail.com
on 14 Apr 2014 at 10:53
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:09
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:17
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:07
Original issue reported on code.google.com by
fgalie...@gmail.com
on 5 Apr 2014 at 4:32