Feedback about the plugin:
============================================
+ written nicely (api, code, ..), with test suite ! (great)

+ works correctly (I've run maybe 2400 additional tests, 200 random runs
  for each method)
  (generating the test cases takes about 0.02 secs, running them takes
  about 6 secs (core-i5)
  (Code generating test code : http://dpaste.com/1634959/)

+ unique selling point (base conversions possible) could be emphasized in README
  This could also be of interest to other plugin writers.

- false statement ? (found in wiki):

  =========== claim:
  Given some UNIX timestamps, determine the average. This is something you 
can't do with Vim numbers.

  let times = [
    \ 1390938148,
    \ 1390759759,
    \ 1391028429,
    \ 1390992724,
    \ 1391100465,
    \ ]
  [...]
  ===============

  Why can't I do this with vim?
  Sample implementation (fun! Average) in benchmark below: [1 little benchmark]
  (I agree it requires float support in Vim)

  Anyway: benchmark for such use case (1000 and 10000 files), done on a core-i5:

  " 1000 numbers : 22ms
  " 10000 numbers: 221ms
  echo tlib#cmd#Time('call Test1()')
  " 1000 numbers : 0ms
  " 10000 numbers: 3ms
  echo tlib#cmd#Time('call Test2()')

Why am I asking about why it was written ?
============================================
If there are strong arguments for adding it I'd like to add it to the list of
things to improve about Vim.

Marc Weber

=== [1 little benchmark]
looks like its still quite fast

fun! Average(list)
  " vim does have float support !
  let avg = 0.0
  for i in a:list
    let avg += i
  endfor
  return avg / len(a:list)
endf

let num = 1390938148
let s:times = []
for i in range(0,10000)
  call add(s:times, num)
endfor

" cannot use it inside a function !??
let s:zero = magnum#ZERO

fun! Test1()
  call magnum#Int(2)
  let sum = s:zero
  for time in s:times
    let sum = sum.Add(magnum#Int(time))
  endfor
  let tally = magnum#Int(len(s:times))
  let s:average_1 = sum.Div(tally).Number()
endf

fun! Test2()
  let s:average_2 = split(printf('%f', round(Average(s:times))), '\.')[0]
endf

" 1000 numbers : 22ms
" 10000 numbers: 221ms
echo tlib#cmd#Time('call Test1()')
" 1000 numbers : 0ms
" 10000 numbers: 3ms
echo tlib#cmd#Time('call Test2()')

echo "expected result: ".num
echo 'magnum result '.s:average_1
echo 'float result  '.s:average_2

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to