Status: Accepted
Owner: ---- Labels: Milestone-2.0 Type-Feature New issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 Some recent Float printing enhancements led to the decision to use exact printing in #printOn:base: The performance difference with inexact printing is however an order of a magnitude. Should be not revise that decision ? | data | data := (1 to: 100000) collect: [ :each | each reciprocal asFloat ]. [ String streamContents: [ :stream | data do: [ :each | stream print: each; space ] ] ] timeToRun. 17776 | data | data := (1 to: 100000) collect: [ :each | each reciprocal asFloat ]. [ String streamContents: [ :stream | data do: [ :each | each absPrintOn: stream base: 10. stream space ] ] ] timeToRun. 1324 _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #1 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 Make that "Should we not revise that decision ?" _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #2 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 I would say yes (to revise) _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #3 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 I would say no, don't revise. Otherwise, Smalltalk will be the only language in the world to print approximately. And that will break REPL and ASCII storage... If speed matters that much, then let's increase speed with a primitive. Do you know that LargeInteger still perform operation byte-wise in this 64 bit era? There is room for speed improvement. _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #4 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 The speed difference is pretty big, wouldn't you say ? [ String new: 2000000 streamContents: [ :stream | 1 to: 100000 do: [ :each | each * Float pi absPrintExactlyOn: stream base: 10. stream space ] ] ] timeToRun. 3471 [ String new: 2000000 streamContents: [ :stream | 1 to: 100000 do: [ :each | each * Float pi absPrintOn: stream base: 10. stream space ] ] ] timeToRun. 754 I am not saying that we have to give up a good property. If you can help optimize it a bit, that would be great. What I am actually looking for is a way for client code to print objects/numbers faster, without having to test for Float and do something entirely different, which isn't very polymorphic. But I don't know the answer: #printOnFast: seems very silly. _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Cc: [hidden email] [hidden email] Labels: -Type-Feature Type-Enh Comment #5 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 Is this a show-stopper for 2.0? _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #6 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 No, it is not a showstopper, but anyone trying to print or write out a file (CSV, JSON, XML, ...) with 1000s of numbers in it will eventually hit this and ask themselves why... _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #7 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 I am going to try to make a patch where a dynamic variable controls the float printing behavior. Then we can test if it is fast enough. _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: FixReviewNeeded Comment #8 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 In inbox: --- Name: SLICE-Issue-7090-Should-FloatgtgtprintOnbase-use-the-slower-exact-printing--SvenVanCaekenberghe.1 Author: SvenVanCaekenberghe Time: 8 February 2013, 12:15:38.79 pm UUID: 79a1110f-0a4e-4731-908e-be7a84ffbf4d Ancestors: Dependencies: Kernel-SvenVanCaekenberghe.1303 introduction of FloatPrintPolicy, a dynamic variable to control how Float>>#printOn:base: works; ExactFloatPrintPolicy double dispatches to Float>>#absPrintExactlyOn:base: for slower but accurate printing [ the current default ]; InexactFloatPrintPolicy double dispatches to Float>>#absPrintOn:base: for faster but potentially less accurate printing. FloatPrintPolicy value: InexactFloatPrintPolicy new during: [ Float pi printString ] --- _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #9 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 To compare the speed: data := (1 to: 100000) collect: [ :each | each reciprocal asFloat ]. data := (1 to: 100000) collect: [ :each | each * Float pi ]. [ FloatPrintPolicy value: InexactFloatPrintPolicy new during: [ String new: 2500000 streamContents: [ :stream | data do: [ :each | stream print: each; space ] ] ] ] timeToRun. [ String new: 2500000 streamContents: [ :stream | data do: [ :each | stream print: each; space ] ] ] timeToRun. _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: MonkeyIsChecking Comment #10 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090#c10 The Monkey is currently checking this issue. Please don't change it! _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: ValidatedByTheMonkey Labels: CheckedIn20524 Comment #11 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090#c11 This Issue has been checked by Ulysse the Monkey 7632 tests passed in 00:02:57s: =============================== CollectionsTests-Arrayed (553) CollectionsTests-Atomic (12) CollectionsTests-Sequenceable (912) CollectionsTests-SplitJoin (27) CollectionsTests-Stack (16) CollectionsTests-Streams (37) CollectionsTests-Strings (611) CollectionsTests-Support (12) CollectionsTests-Unordered (1954) CollectionsTests-Weak (739) CompilerTests (181) KernelTests-Chronology (1186) KernelTests-Classes (138) KernelTests-Exception (5) KernelTests-Methods (359) KernelTests-Numbers (552) KernelTests-Objects (172) KernelTests-Pragmas (6) KernelTests-Processes (76) SUnit-Core-Extensions (3) SUnit-Core-Utilities (3) SUnit-Tests-Core (78) ---------------------------------------------------------- Loaded Source: SLICE-Issue-7090-Should-FloatgtgtprintOnbase-use-the-slower-exact-printing--SvenVanCaekenberghe.1 from http://ss3.gemstone.com/ss/PharoInbox Tested using Pharo-2.0-20524-a on NBCoInterpreter NativeBoost-CogPlugin-IgorStasenko.15 uuid: 44b6b681-38f1-4a9e-b6ee-8769b499576a Nov 27 2012 NBCogit NativeBoost-CogPlugin-IgorStasenko.15 uuid: 44b6b681-38f1-4a9e-b6ee-8769b499576a Nov 27 2012 https://git.gitorious.org/cogvm/blessed.git Commit: 40ac7e7bdec6fef0e934d2c019b86db996053912 Date: 2012-11-19 18:54:49 +0100 By: Mariano Martinez Peck <[hidden email]> Jenkins build #146 _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #12 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 Some human review would not hurt. The code works, it is just that it adds to Kernel-Numbers _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: HumanReviewNeeded Comment #13 on issue 7090 by [hidden email]: Should Float>>#printOn:base: use the slower exact printing ? http://code.google.com/p/pharo/issues/detail?id=7090 (No comment was entered for this change.) _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Free forum by Nabble | Edit this page |