You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by velvia <gi...@git.apache.org> on 2014/03/24 08:06:50 UTC
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
GitHub user velvia opened a pull request:
https://github.com/apache/spark/pull/215
SPARK-1057: Upgrade fastutil to 6.5.11
A really simple PR to upgrade the fastutil library to one of the latest versions, 6.5.11; a couple deprecated APIs are removed and a couple nice fixes to underlying OpenHashMaps (used in a couple places) are brought in.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/velvia/spark SPARK-1057-upgrade-fastutil
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/215.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #215
----
commit 9f549989452b2726fedb7013fb1d354a25aa3f88
Author: Evan Chan <ev...@ooyala.com>
Date: 2014-03-24T07:04:36Z
Upgrade fastutil to 6.5.11
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38417092
LGTM - not sure about merging into 0.9.1 though.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38419531
Merged build finished.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by velvia <gi...@git.apache.org>.
Github user velvia commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38514709
This is the changelog. One thing not noted here is that one of the APIs in
the hash maps, add(), has also been deprecated and is not available in
newer versions, and was being used to Spark, so it caused difficulties if
newer version of fastutil is used. This might have been removed from Spark
code however.
6.5.12
- Removed some useless wrapper creation in a few methods of tree-based map
classes.
- Fixed pathological maxFill computation for very small-sized big open
hash sets.
6.5.11
- A very old and subtle performance bug in hash-based data structures has
been fixed. Backing arrays were allocated using the number of expected
elements divided by the load factor. However, since the test for
rehashing was fired by equality with the table size multiplied by the
load factor, if the expected number of elements multiplied by the load
factor was an integer a useless rehash would happen for the very last
added element. The only effect was an useless increase in object
creation.
6.5.10
- Now iterators in object set constructors are of type Iterator, and not
anymore ObjectIterator. The kind of allowed iterators has been
rationalised and made uniform through all classes implementing Set.
6.5.9
- New methods to get a type-specific Iterable from binary or
text files.
6.5.8
- Fixed stupid bug in creation of array-based FIFO queues.
6.5.7
- Fixed a very subtle bug in hash-based data structures: addAll() to a
newly created structure could require a very long time due to
correlation between the positions in structures with different table
sizes.
6.5.6
- equals() method between arrays have been deprecated in favour of the
java.util.Arrays version, which is intrinsified in recent JVMs.
- InspectableFileCachedInputStream.reopen() makes it possible to
read again from the start an instance on which close() was
invoked.
6.5.5
- The abstract implementation of equals() between (big) lists now uses
type-specific access methods (as the compareTo() method was already
doing) to avoid massive boxing/unboxing. Thanks to Adrien Grand for
suggesting this improvement.
- FIFO array-based queues are now serializable.
6.5.4
- Further fixes related to NaNs in sorting.
- Fixed very old bug in FastByteArrayOutputStream.write(int).
Thanks to Massimo Santini for reporting this bug.
- We now use Arrays.MAX_ARRAY_SIZE, which is equal to Integer.MAX_VALUE
minus 8, to bound all array allocations. Previously, it might happen
that grow() and other array-related functions could try to allocate an
array of size Integer.MAX_VALUE, which is technically correct from the
JLS, but will not work on most JVMs. The maximum length we use now is
the same value as that used by java.util.ArrayList. Thanks to William
Harvey for suggesting this change.
6.5.3
- Corrected erroneous introduction of compare() methods on integral
classes (they appeared in Java 7).
6.5.2
- A few changes were necessary to make fastutil behave as Java on NaNs
when sorting. Double.compareTo() and Float.compareTo() treat Double.NaN
as greater than Double.POSITIVE_INFINITY, and fastutil was not doing it.
As part of the change, now all comparisons between primitive types are
performed using the compare() method of the wrapper class
(microbenchmarks confirmed that there is no speed penalty for that,
probably due to inlining or even intrinsification). Thanks to Adam Klein
for reporting this bug.
- All quickSort() implementations that do not involve a comparator are now
deprecated, as there are equivalent/better versions in java.util.Arrays.
6.5.0 -> 6.5.1
- Now FastBuffered{Input/Output}Stream has a constructor with an
explicitly given buffer.
- Abandoned golden-ratio based expansion of arrays and lists in favour of
a (more standard) doubling approach.
- Array-based FIFO queues now reduce their capacity automatically by
halving when the size becomes one fourth of the length.
- The add() method for open hash maps has been deprecated and replaced by
addTo(), as the name choice proved to be a recipe for disaster.
- New InspectableFileCachedInputStream for caching easily large byte
streams partially on file and partially in memory.
- The front() method for semi-indirect heaps took no comparator, but
was used in queues in which you could support a comparator. There
is now a further version accepting a comparator.
- Serial Version UIDs are now private.
6.4.6 -> 6.5.0
- Fixed type of array hash strategies.
- Fixed use of equals() instead of compareTo() in
SemiIndirectHeaps.front(). Thanks to Matthew Hatem for reporting this
bug.
- Now we generate custom hash maps for primite types, too (as we were
already doing for sets).
6.4.5 -> 6.4.6
- In array-based priority queues changed() would not invalidate
the cached index of the smallest element.
6.4.4 -> 6.4.5
- In some very rare circumstances, enumeration of hash sets or maps
combined with massive element removal (using the iterator remove()
method) could have led to inconsistent enumeration (duplicates and
missing elements). Thanks to Hamish Morgan for reporting this bug.
On Mon, Mar 24, 2014 at 11:19 AM, Aaron Davidson
<no...@github.com>wrote:
> What are the fixes to the OpenHashMaps? Their severity may impact whether
> we have to pick this into branch-0.9.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/apache/spark/pull/215#issuecomment-38480889>
> .
>
--
The fruit of silence is prayer;
the fruit of prayer is faith;
the fruit of faith is love;
the fruit of love is service;
the fruit of service is peace. -- Mother Teresa
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38419532
All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/13384/
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by velvia <gi...@git.apache.org>.
Github user velvia commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-40295287
Ok.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38775656
FWIW +1, fastutil is a beast. I volunteer to take a crack at the necessary change to understand what it looks like, if anyone will second the motion.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38416905
Merged build triggered.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-39038332
PS I put together a look at what removing fastutil would look like, as a separate PR: https://github.com/apache/spark/pull/266
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38881857
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by aarondav <gi...@git.apache.org>.
Github user aarondav commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38480889
What are the fixes to the OpenHashMaps? Their severity may impact whether we have to pick this into branch-0.9.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by velvia <gi...@git.apache.org>.
Github user velvia commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38775813
So I was just looking at this. fastutil is used in about 15 different
files, and mostly what is used is:
- A few of the hashmaps
- import it.unimi.dsi.fastutil.io.FastBufferedInputStream
- FastByteArrayOutputStream
I totally agree fastutil is a huge dep, but we only have a week left for
merge window -- is there time to find a comparable replacement for the
Fast*Stream stuff?
-Evan
On Wed, Mar 26, 2014 at 6:58 PM, Matei Zaharia <no...@github.com>wrote:
> I wonder if we should just get rid of FastUtil -- it's a big dependency
> (due to having lots of specialized classes) and we only use it in a few
> places.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/apache/spark/pull/215#issuecomment-38761764>
> .
>
--
The fruit of silence is prayer;
the fruit of prayer is faith;
the fruit of faith is love;
the fruit of love is service;
the fruit of service is peace. -- Mother Teresa
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38881217
OpenHashMap specializes both keys and values. If the keys are known to be primitive and cannot be null, you can also use PrimitiveKeyOpenHashMap
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38416906
Merged build started.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38822774
@srowen want to take a crack? If it can't get in in-time then we can merge this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38824292
@pwendell @velvia Yes almost done now. A few preliminary notes, which might affect all your opinions on this:
- The uses of `FastBuffered{Input,Output}Stream` look safe to replace with `Buffered{Input,Output}Stream` because none of their special methods are used, and any performance differences look trivial for purposes here
- `FastByteArrayInputStream`'s difference seems to be just different behavior in case of a 0-byte read at EOF. The docs say the difference is a fix; to me the required API is kinda ambiguous and this is unlikely to be an issue anyway.
- Use of 32-bit MurmurHash3 is easily replaced with Guava
- Use of `FastByteArrayOutputStream` is a little more contentious, since it lets you access the raw byte array rather than copy it. However, in 2 of 3 uses, the byte array is copied anyway due to a call to `trim()`. Still there is 1 use where it will make a difference.
- It's functionally easy to replace uses of the maps with `mutable.Map[T,Long]`. They may be slower. There's one case in `examples` where it looks like a lot of care was taken to use this efficiently. This can be handled a bit specially. It's only in examples.
Keep in mind it's also possible to write some shading exclusion rules to trim out parts of fastutil that aren't needed for sure. That's another way to go.
Once I get it finished and tests pass I'll open a PR just for a look at what it concretely looks like.
_Other small note: the project seems clearly labeled as AL2.0 licensed, but lots of the source I'm looking through is labeled LGPL 2.1. I think this must be an oversight but gave me pause._
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by velvia <gi...@git.apache.org>.
Github user velvia closed the pull request at:
https://github.com/apache/spark/pull/215
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38765242
(Specifically the fastutil JAR is about 16 MB, which is about one sixth of our assembly JAR!)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38761764
I wonder if we should just get rid of FastUtil -- it's a big dependency (due to having lots of specialized classes) and we only use it in a few places.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38775806
I third the motion!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-40294619
@velvia mind closing this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38872589
Yes indeed, I replaced the fastutil set with OpenHashSet. Unfortunately the fastutil map had primitive values whereas OpenHashMap has specialized support in its keys?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] spark pull request: SPARK-1057: Upgrade fastutil to 6.5.11
Posted by mateiz <gi...@git.apache.org>.
Github user mateiz commented on the pull request:
https://github.com/apache/spark/pull/215#issuecomment-38872420
For some of the maps we can also use org.apache.spark.util.collection.OpenHashMap, which is specialized for primitive types.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---