Branch: refs/heads/master
  Home:   https://github.com/yi-editor/yi
  Commit: 9437fbccd98083e72d8ba83b18b41162138a952d
      
https://github.com/yi-editor/yi/commit/9437fbccd98083e72d8ba83b18b41162138a952d
  Author: Mateusz Kowalczyk <fuuze...@fuuzetsu.co.uk>
  Date:   2014-09-29 (Mon, 29 Sep 2014)

  Changed paths:
    M yi/src/library/Yi/Buffer/Implementation.hs
    M yi/src/library/Yi/Buffer/Misc.hs
    M yi/src/library/Yi/Buffer/TextUnit.hs
    M yi/yi.cabal

  Log Message:
  -----------
  Optimise TextUnit to work over YiString

Additionally we optimise the case for going to EOL. I think we can still
do better however as a 100MB line takes 50 CPU seconds still (but it
does complete and doesn't OOM like before). It seems there's 10x memory
improvement but I suspect it's much more as evident by the where we
spend most of our resources in unrelated functions.

We can probably do a similar optimisation for words.

The biggest problem the previous approach had was looking for bounds on
character-by-character basis instead of making bigger jumps, in this
case just making one jump.

Some perf for a line with 10240 characters, after this commit:

        Mon Sep 29 12:07 2014 Time and Allocation Profiling Report  (Final)
     C-e with betweenB offset, no move, optimise for lines
           yi +RTS -P -hc -RTS --as=emacs -y /tmp /tmp/supershort

        total time  =        0.09 secs   (87 ticks @ 1000 us, 1 processor)
        total alloc =  35,225,576 bytes  (excludes profiling overheads)

COST CENTRE                    MODULE                      %time %alloc  ticks  
   bytes

render.\                       Yi.UI.Pango                  35.6    0.0     31  
   11952
updatePango                    Yi.UI.Pango                  19.5   18.5     17  
 6523392
startNoMsgGtkHook              Yi.UI.Pango                   9.2    0.1      8  
   28472
appUserDataCond                Yi.Paths                      5.7   27.4      5  
 9636944
fmap                           Yi.Buffer.Misc                5.7    5.8      5  
 2044104
yiDriver                       Yi.Boot                       5.7   27.7      5  
 9766192
newWindow                      Yi.UI.Pango                   4.6    0.0      4  
   15616
>>=                            Yi.Keymap                     2.3    0.3      2  
>>   94992
CAF                            GHC.IO.Encoding.Iconv         1.1    0.0      1  
     232
canAccept                      Text.Regex.TDFA.CorePattern   1.1    0.0      1  
    1856
loadIcon                       Yi.UI.Pango.Utils             1.1    0.0      1  
    1936
askBuffer                      Yi.UI.Pango                   1.1    0.0      1  
       0
listify                        Yi.String                     1.1    0.0      1  
    6288
withGivenBufferAndWindow0.edit Yi.Editor                     1.1    0.0      1  
   16416
checkFileChanges.\             Yi.Core                       1.1    0.1      1  
   32752
checkFileChanges.fileModTime   Yi.Core                       1.1    0.1      1  
   34272
>>=                            Yi.Buffer.Misc                1.1    1.9      1  
>>  657920
runBuffer.(...)                Yi.Buffer.Misc                1.1    0.0      1  
    4256
editFile.fileToNewBuffer       Yi.File                       0.0    2.8      0  
  981432

Before this commit:

        Mon Sep 29 05:41 2014 Time and Allocation Profiling Report  (Final)
     C-e in /tmp/supershort (10240 chars) pre boundry-fixes
           yi +RTS -P -hc -RTS --as=emacs -y /tmp /tmp/supershort

        total time  =        0.61 secs   (613 ticks @ 1000 us, 1 processor)
        total alloc = 472,973,992 bytes  (excludes profiling overheads)

COST CENTRE       MODULE                   %time %alloc  ticks     bytes

>>=               Yi.Buffer.Misc            23.3   19.6    143  92822024
getStream'        Yi.Buffer.Implementation  15.7   42.2     96 199410456
startNoMsgGtkHook Yi.UI.Pango                5.7    0.0     35     30560
render.\          Yi.UI.Pango                4.6    0.0     28     11952
fmap              Yi.Buffer.Misc             3.6    5.1     22  23918328
moveTo            Yi.Buffer.Misc             3.3    3.4     20  16222288
getMarksRaw       Yi.Buffer.Misc             2.9    4.2     18  19710880
getMarks          Yi.Buffer.Misc             2.8    3.3     17  15601832
modifyMarkBI      Yi.Buffer.Implementation   2.4    1.4     15   6636192
state             Yi.Buffer.Misc             2.3    2.5     14  11638456
updatePango       Yi.UI.Pango                2.1    1.4     13   6523392
yiDriver          Yi.Boot                    2.0    2.1     12   9766192
markPointA.getter Yi.Buffer.Misc             1.8    0.2     11   1149472
savingPrefCol     Yi.Buffer.Misc             1.6    1.6     10   7455648
doUntilB.loop     Yi.Buffer.TextUnit         1.5    0.7      9   3195032
savingPointB      Yi.Buffer.Misc             1.5    1.1      9   5079616
forgetPreferCol   Yi.Buffer.Misc             1.5    2.0      9   9340824
appUserDataCond   Yi.Paths                   1.3    2.0      8   9636944
moveN             Yi.Buffer.Misc             1.3    0.5      8   2293984
markPointA        Yi.Buffer.Misc             0.7    1.7      4   8205280


-- 
-- 
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel
--- 
You received this message because you are subscribed to the Google Groups 
"yi.devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to yi-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to