Last active
August 29, 2015 14:00
-
-
Save argiopetech/49153245df28b5750940 to your computer and use it in GitHub Desktop.
Graphics.Rendering.Chart: Excessive memory use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
-- Point coloring | |
import Data.Colour hiding (atop) | |
import Data.Colour.Names | |
-- File input/parsing | |
import Control.Monad.Trans.Resource | |
import Data.Attoparsec.ByteString.Char8 | |
import Data.Conduit | |
import Data.Conduit.Attoparsec | |
import Data.Conduit.Binary as C | |
-- Default instances | |
import Data.Default.Class | |
-- Chart + Diagrams | |
import Diagrams.Backend.Cairo.CmdLine | |
import Graphics.Rendering.Chart | |
import Graphics.Rendering.Chart.Backend.Diagrams | |
-- Misc | |
import Control.Applicative | |
import Control.Lens | |
default (Int, Double) | |
data Photometry = Photometry { _u :: !Double | |
, _b :: !Double | |
, _v :: !Double | |
} deriving (Show) | |
photometryParser :: Parser Photometry | |
photometryParser = Photometry <$> double <* skipSpace <*> | |
double <* skipSpace <*> | |
double <* skipSpace <* | |
double <* skipSpace <* | |
double <* skipSpace <* | |
double <* skipSpace <* | |
double <* skipSpace <* | |
double | |
photometryParsers :: Parser [Photometry] | |
photometryParsers = photometryParser `sepBy'` char '\n' | |
main :: IO () | |
main = do | |
phot <- fmap (filter (\p -> _u p < 99.0)) $ runResourceT $ sourceFile "SimulatedPhotometry.out" $$ sinkParser photometryParsers | |
denv <- defaultEnv vectorAlignmentFns 600 400 | |
let chart0 = fst $ runBackendR denv $ toRenderable $ layout $ points0 phot | |
defaultMain chart0 | |
points0 :: [Photometry] -> PlotPoints Double Double | |
points0 phot = plot_points_style .~ filledCircles 1 (opaque red) | |
$ plot_points_values .~ [(b-v, v) | (Photometry _ b v) <- phot] | |
$ plot_points_title .~ "V/B- V" | |
$ def | |
layout :: PlotPoints Double Double -> Layout Double Double | |
layout points = layout_title .~ "DSED MS CMD -- " ++ show (fromIntegral (round $ (10 ** 9.8) / 1e6) / 1e3) ++ " gigayears" | |
$ layout_plots .~ map toPlot [points] | |
$ layout_x_axis .~ ( laxis_title .~ "V" | |
$ laxis_generate .~ (scaledAxis def (-2, 6)) | |
$ def) | |
$ layout_y_axis .~ ( laxis_title .~ "" $ laxis_reverse .~ True | |
$ laxis_generate .~ (scaledAxis def (-2, 16)) | |
$ def) | |
$ def |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thu May 1 14:54 2014 Time and Allocation Profiling Report (Final) | |
simpleplots +RTS -s -P -RTS -o dsed_sim.png | |
total time = 26.24 secs (26236 ticks @ 1000 us, 1 processor) | |
total alloc = 17,088,768,104 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc ticks bytes | |
main Main 67.6 40.0 17744 6827846000 | |
main.chart0 Main 27.0 50.4 7084 8610609440 | |
photometryParser Main 3.1 6.7 806 1140480392 | |
~> Data.MemoTrie 1.9 2.4 493 411010000 | |
individual inherited | |
COST CENTRE MODULE no. entries %time %alloc %time %alloc ticks bytes | |
MAIN MAIN 385 0 0.0 0.0 100.0 100.0 0 856 | |
main Main 771 0 67.6 40.0 100.0 100.0 17744 6827842504 | |
fmap Data.MemoTrie 809 223375 0.0 0.1 2.0 2.6 13 10722000 | |
inTrie Data.MemoTrie 810 223375 0.1 0.1 2.0 2.5 20 16083000 | |
~> Data.MemoTrie 811 223375 1.9 2.4 1.9 2.4 493 411010000 | |
trie Data.MemoTrie 808 2 0.0 0.0 0.0 0.0 0 96 | |
untrie Data.MemoTrie 806 4 0.0 0.0 0.0 0.0 0 0 | |
untrie.\ Data.MemoTrie 807 4 0.0 0.0 0.0 0.0 0 0 | |
unstream/resize Data.Text.Internal.Fusion 797 998 0.0 0.0 0.0 0.0 0 102224 | |
main.\ Main 794 75000 0.0 0.0 0.0 0.0 7 0 | |
_u Main 795 75000 0.0 0.0 0.0 0.0 0 0 | |
main.chart0 Main 781 1 27.0 50.4 27.3 50.8 7084 8610609440 | |
unstream/resize Data.Text.Internal.Fusion 798 35941 0.0 0.0 0.0 0.0 5 3681512 | |
points0 Main 791 1 0.0 0.0 0.0 0.0 1 7734512 | |
layout Main 782 1 0.2 0.4 0.2 0.4 63 60200488 | |
photometryParsers Main 778 0 0.0 0.0 3.1 6.7 0 216 | |
photometryParser Main 780 0 3.1 6.7 3.1 6.7 806 1140480392 | |
CAF:main1 Main 768 0 0.0 0.0 0.0 0.0 0 16 | |
main Main 770 1 0.0 0.0 0.0 0.0 0 0 | |
CAF:main16 Main 767 0 0.0 0.0 0.0 0.0 0 0 | |
main Main 772 0 0.0 0.0 0.0 0.0 0 320 | |
CAF:main_ds Main 766 0 0.0 0.0 0.0 0.0 0 0 | |
main Main 773 0 0.0 0.0 0.0 0.0 0 224 | |
CAF:main21 Main 765 0 0.0 0.0 0.0 0.0 0 0 | |
main Main 774 0 0.0 0.0 0.0 0.0 0 776 | |
CAF:main31 Main 764 0 0.0 0.0 0.0 0.0 0 0 | |
main Main 775 0 0.0 0.0 0.0 0.0 0 504 | |
CAF:main32 Main 763 0 0.0 0.0 0.0 0.0 0 0 | |
main Main 776 0 0.0 0.0 0.0 0.0 0 1672 | |
CAF:layout2 Main 761 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 783 0 0.0 0.0 0.0 0.0 0 232 | |
CAF:layout3 Main 760 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 784 0 0.0 0.0 0.0 0.0 0 216 | |
CAF:layout7 Main 759 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 786 0 0.0 0.0 0.0 0.0 0 208 | |
CAF:layout8 Main 758 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 787 0 0.0 0.0 0.0 0.0 0 208 | |
CAF:layout9 Main 757 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 788 0 0.0 0.0 0.0 0.0 0 224 | |
CAF:layout18 Main 756 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 789 0 0.0 0.0 0.0 0.0 0 208 | |
CAF:layout19 Main 755 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 790 0 0.0 0.0 0.0 0.0 0 224 | |
CAF:layout27 Main 754 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 785 0 0.0 0.0 0.0 0.0 0 1120 | |
CAF:layout28 Main 753 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 799 0 0.0 0.0 0.0 0.0 0 256 | |
CAF:layout29 Main 752 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 805 0 0.0 0.0 0.0 0.0 0 736 | |
CAF:layout30 Main 751 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 800 0 0.0 0.0 0.0 0.0 0 2480 | |
CAF:layout31 Main 750 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 801 0 0.0 0.0 0.0 0.0 0 32 | |
CAF:layout32 Main 749 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 802 0 0.0 0.0 0.0 0.0 0 32 | |
CAF:layout33 Main 748 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 803 0 0.0 0.0 0.0 0.0 0 32 | |
CAF:layout34 Main 747 0 0.0 0.0 0.0 0.0 0 0 | |
layout Main 804 0 0.0 0.0 0.0 0.0 0 16 | |
CAF:main2 Main 746 0 0.0 0.0 0.0 0.0 0 0 | |
points0 Main 792 0 0.0 0.0 0.0 0.0 0 160 | |
CAF:main4 Main 745 0 0.0 0.0 0.0 0.0 0 0 | |
points0 Main 796 0 0.0 0.0 0.0 0.0 0 448 | |
CAF:main22 Main 743 0 0.0 0.0 0.0 0.0 0 0 | |
photometryParsers Main 777 1 0.0 0.0 0.0 0.0 0 40 | |
CAF:main27 Main 740 0 0.0 0.0 0.0 0.0 0 16 | |
photometryParser Main 779 1 0.0 0.0 0.0 0.0 0 0 | |
CAF:main33 Main 739 0 0.0 0.0 0.0 0.0 0 88 | |
CAF:main34 Main 738 0 0.0 0.0 0.0 0.0 0 88 | |
CAF:main37 Main 737 0 0.0 0.0 0.0 0.0 0 48 | |
CAF:main29 Main 735 0 0.0 0.0 0.0 0.0 0 88 | |
CAF Diagrams.Backend.Cairo.CmdLine 726 0 0.0 0.0 0.0 0.0 0 1264 | |
CAF Diagrams.Backend.Cairo.Internal 725 0 0.0 0.0 0.0 0.0 0 1568 | |
CAF Graphics.Rendering.Chart.Backend.Diagrams 685 0 0.0 0.0 0.0 0.0 0 8096 | |
CAF Paths_Chart_diagrams 684 0 0.0 0.0 0.0 0.0 0 6584 | |
CAF Graphics.SVGFonts.ReadFont 678 0 0.0 0.0 0.0 0.0 0 152696 | |
CAF Graphics.SVGFonts.CharReference 677 0 0.0 0.0 0.0 0.0 0 936 | |
CAF Graphics.SVGFonts.ReadPath 676 0 0.0 0.0 0.0 0.0 0 6296 | |
CAF Text.XML.Light.Input 672 0 0.0 0.0 0.0 0.0 0 160 | |
CAF Text.Parsec.Token 662 0 0.0 0.0 0.0 0.0 0 480 | |
CAF Diagrams.Attributes 659 0 0.0 0.0 0.0 0.0 0 7816 | |
CAF Diagrams.TwoD.Combinators 649 0 0.0 0.0 0.0 0.0 0 40 | |
CAF Diagrams.TwoD.Transform 648 0 0.0 0.0 0.0 0.0 0 24 | |
CAF Diagrams.TwoD.Arc 647 0 0.0 0.0 0.0 0.0 0 5048 | |
CAF Diagrams.TwoD.Path 645 0 0.0 0.0 0.0 0.0 0 1280 | |
CAF Diagrams.TwoD.Text 641 0 0.0 0.0 0.0 0.0 0 1088 | |
CAF Diagrams.TwoD.Adjust 639 0 0.0 0.0 0.0 0.0 0 488 | |
CAF Diagrams.Backend.CmdLine 637 0 0.0 0.0 0.0 0.0 0 4464 | |
CAF Diagrams.TwoD.Polygons 631 0 0.0 0.0 0.0 0.0 0 32 | |
CAF Options.Applicative.BashCompletion 621 0 0.0 0.0 0.0 0.0 0 1416 | |
CAF Options.Applicative.Common 620 0 0.0 0.0 0.0 0.0 0 160 | |
CAF Graphics.Rendering.Chart.Axis.Types 565 0 0.0 0.0 0.0 0.0 0 72 | |
CAF Graphics.Rendering.Chart.Layout 564 0 0.0 0.0 0.0 0.0 0 504 | |
CAF Graphics.Rendering.Chart.Backend.Types 559 0 0.0 0.0 0.0 0.0 0 736 | |
CAF Data.Text.Array 485 0 0.0 0.0 0.0 0.0 0 32 | |
CAF Data.Text.Internal 482 0 0.0 0.0 0.0 0.0 0 48 | |
CAF GHC.Conc.Signal 438 0 0.0 0.0 0.0 0.0 0 656 | |
CAF GHC.Float 434 0 0.0 0.0 0.0 0.0 0 46392 | |
CAF GHC.Float.ConversionUtils 433 0 0.0 0.0 0.0 0.0 0 304 | |
CAF GHC.IO.Encoding 430 0 0.0 0.0 0.0 0.0 0 3808 | |
CAF GHC.IO.Encoding.Iconv 429 0 0.0 0.0 0.0 0.0 0 232 | |
CAF GHC.IO.FD 424 0 0.0 0.0 0.0 0.0 0 16 | |
CAF GHC.IO.Handle.FD 422 0 0.0 0.0 0.0 0.0 0 34480 | |
CAF Text.Read.Lex 405 0 0.0 0.0 0.0 0.0 0 2632 | |
CAF GHC.Integer.Logarithms.Internals 393 0 0.0 0.0 0.0 0.0 0 304 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment