From hanssv@REDACTED Mon Aug 18 10:43:15 2014 From: hanssv@REDACTED (Hans Svensson) Date: Mon, 18 Aug 2014 10:43:15 +0200 Subject: [erlang-patches] Bottleneck in cover:reset/0 Message-ID: <53F1BCA3.8080104@gmail.com> We observed that our test suite was spending significant time (~10s) resetting cover - The issue was that to avoid building "long lists" reset was done on a per-clause basis, where each reset contained a call to ets:match_object. It should be a safe optimization to assume that the list of clauses/lines fits in memory. (If that is not the case reset/0 will hardly be the main problem!) While covering ~30 medium sized modules (~50 clauses per module) this patch reduced the time for reset/0 from 340ms to 8ms. And for the full test suite 6600ms was reduced to 30ms. Cheers, Hans git fetch git://github.com/hanssv/otp.git cover_reset_bottleneck https://github.com/hanssv/otp/compare/erlang:maint...cover_reset_bottleneck https://github.com/hanssv/otp/compare/erlang:maint...cover_reset_bottleneck.patch From mikpelinux@REDACTED Wed Aug 20 09:53:52 2014 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Wed, 20 Aug 2014 09:53:52 +0200 Subject: [erlang-patches] [PATCH] correct conversion of MIN_SMALL numeral to fixnum Message-ID: <21492.21520.611653.833984@gargle.gargle.HOWL> Conversion of MIN_SMALL as a numeral to an Erlang integer, via binary_to_integer/1 or list_to_integer/1, succeeds but creates the integer as a negative bignum. This is incorrect as (a) the value fits in a fixnum, and (b) the VM expects values that fit in fixnums to also be fixnums. The bug is that the numeral is converted first as a non-negative number, and then finally negated if prefixed by a unary minus sign. MIN_SMALL without the sign is MAX_SMALL+1, which doesn't fit in a fixnum, so the value before the negation is a bignum. To correct the representation after the negation call big_plus_small with zero, as already done in other places. Tested with the emulator testsuite on Linux/x86_64, no regressions. Thanks to Jesper Louis Andersen for the report to erlang-bugs. Signed-off-by: Mikael Pettersson Links: git fetch git://github.com/mikpe/otp.git MIN_SMALL-to-integer https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer.patch https://github.com/erlang/otp/pull/452 From jesper.louis.andersen@REDACTED Wed Aug 20 11:49:23 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 20 Aug 2014 11:49:23 +0200 Subject: [erlang-patches] [PATCH] correct conversion of MIN_SMALL numeral to fixnum In-Reply-To: <21492.21520.611653.833984@gargle.gargle.HOWL> References: <21492.21520.611653.833984@gargle.gargle.HOWL> Message-ID: I would definitely add test cases for this to the test suite. It warrants one on the evil corner case numbers to make sure they are right in the future. On Wed, Aug 20, 2014 at 9:53 AM, Mikael Pettersson wrote: > Conversion of MIN_SMALL as a numeral to an Erlang integer, via > binary_to_integer/1 or list_to_integer/1, succeeds but creates > the integer as a negative bignum. This is incorrect as (a) the > value fits in a fixnum, and (b) the VM expects values that fit > in fixnums to also be fixnums. The bug is that the numeral is > converted first as a non-negative number, and then finally > negated if prefixed by a unary minus sign. MIN_SMALL without > the sign is MAX_SMALL+1, which doesn't fit in a fixnum, so the > value before the negation is a bignum. To correct the > representation after the negation call big_plus_small with zero, > as already done in other places. > > Tested with the emulator testsuite on Linux/x86_64, no regressions. > > Thanks to Jesper Louis Andersen for the report to erlang-bugs. > > Signed-off-by: Mikael Pettersson > > Links: > > git fetch git://github.com/mikpe/otp.git MIN_SMALL-to-integer > > https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer > > https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer.patch > > https://github.com/erlang/otp/pull/452 > _______________________________________________ > erlang-patches mailing list > erlang-patches@REDACTED > http://erlang.org/mailman/listinfo/erlang-patches > -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikpelinux@REDACTED Thu Aug 21 09:46:07 2014 From: mikpelinux@REDACTED (Mikael Pettersson) Date: Thu, 21 Aug 2014 09:46:07 +0200 Subject: [erlang-patches] [PATCH] correct conversion of MIN_SMALL numeral to fixnum In-Reply-To: References: <21492.21520.611653.833984@gargle.gargle.HOWL> Message-ID: <21493.41919.993088.530543@gargle.gargle.HOWL> Jesper Louis Andersen writes: > I would definitely add test cases for this to the test suite. It warrants > one on the evil corner case numbers to make sure they are right in the > future. Ok, I'm adding some test cases. > > > On Wed, Aug 20, 2014 at 9:53 AM, Mikael Pettersson > wrote: > > > Conversion of MIN_SMALL as a numeral to an Erlang integer, via > > binary_to_integer/1 or list_to_integer/1, succeeds but creates > > the integer as a negative bignum. This is incorrect as (a) the > > value fits in a fixnum, and (b) the VM expects values that fit > > in fixnums to also be fixnums. The bug is that the numeral is > > converted first as a non-negative number, and then finally > > negated if prefixed by a unary minus sign. MIN_SMALL without > > the sign is MAX_SMALL+1, which doesn't fit in a fixnum, so the > > value before the negation is a bignum. To correct the > > representation after the negation call big_plus_small with zero, > > as already done in other places. > > > > Tested with the emulator testsuite on Linux/x86_64, no regressions. > > > > Thanks to Jesper Louis Andersen for the report to erlang-bugs. > > > > Signed-off-by: Mikael Pettersson > > > > Links: > > > > git fetch git://github.com/mikpe/otp.git MIN_SMALL-to-integer > > > > https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer > > > > https://github.com/mikpe/otp/compare/erlang:maint...MIN_SMALL-to-integer.patch > > > > https://github.com/erlang/otp/pull/452 > > _______________________________________________ > > erlang-patches mailing list > > erlang-patches@REDACTED > > http://erlang.org/mailman/listinfo/erlang-patches > > > > > > -- > J. --