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
# # ssh to Rackspace 16 vCPU box to perf test lmdb | |
# # try to do a similar multi-process test to the one at https://github.com/simonhf/sharedhashfile | |
# # note: could not figure out how to insert more that 70 million keys; other test inserts 100 million keys | |
# # note: created lmdb hash file on /dev/shm to make it a fairer test | |
# # note: as you can see below, inserting is extremely slow but lmdb only claims that reading is lighting fast :-) | |
# # note: the 'mix' 2% update, 98% read test shows that read performance gets bogged down if reading & writing :-( | |
# # note: not sure if I am using the lmdb API is the optimum way so please forgive me & suggest changes! | |
# # note: comments to feedback@sharedhashfile.com please | |
# apt-get update | |
# apt-get install build-essential |
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
function DeleteArrayElements( array, index, count ) | |
-- Deletes one or more (count) array elements from the specified index. | |
-- Returns an undo function, which if called would revert the operation. | |
local deletedElements = {} | |
assert( index >= 1 and index <= #array, "index=" .. index .. " must be >= 1 and <= " .. #array .. " (#array)" ) | |
assert( count >= 1 and count <= #array - index + 1, "count=" .. count .. " must be >= 1 and <= " .. #array - index + 1 .. " (#array - index + 1) where #array=" .. #array .. " and index=" .. index) | |
for i = 0, count - 1 do |
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
/** | |
* On my CentOS 5 system this application sent the first 3000 messages | |
* with a running memory footprint less than 7 MB. In a few minutes, it | |
* leveled out at 18MB. Based on the sending rate, the maximum data rate | |
* out of this process should be less than 75kbps -- well below the | |
* ZMQ_RATE of 10Mbps. While there doesn't seem to be a long-term leak, | |
* the fact that this application does the first 3000 sends with a memory | |
* footprint far less than it's terminal value is concerning. | |
* | |
* If I change nothing other than the ZMQ_RATE value and change it to |
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
local function out_of_range(i,n) | |
if type(i) == 'number' then | |
if i > 0 and i <= n then return true | |
else error('out of range',3) | |
end | |
else | |
error 'cannot index array by non-number type' | |
end | |
end |
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
diff --git a/win32/win32.c b/win32/win32.c | |
index 6366d92..4e52d7b 100644 | |
--- a/win32/win32.c | |
+++ b/win32/win32.c | |
@@ -4115,39 +4115,62 @@ winnt_stat(const WCHAR *path, struct stati64 *st) | |
{ | |
HANDLE h; | |
WIN32_FIND_DATAW wfd; | |
+ WIN32_FILE_ATTRIBUTE_DATA wfa; | |
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
" Function: OpenPdfToSection | |
function! OpenPdfToSection() | |
let g:my_section = substitute(getline(search('\\\(sub\)\?section', 'bn')), '\\\%(sub\)\?section{\([^}]\+\)}', '\1', '') | |
" some weird trailing space can appear, remove them | |
let g:my_section = substitute(g:my_section, "^ *", "", "g") | |
let g:Tex_ViewRuleComplete_pdf = 'mupdf -f "'.g:my_section.'" -r 102 $*.pdf' | |
call Tex_ViewLaTeX() | |
" reinitialize the variable to keep <leader>lv working | |
let g:Tex_ViewRuleComplete_pdf = 'mupdf -r 102 $*.pdf' | |
endfunction |
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
-- Something like (ZeroMQ in this case) | |
return { | |
typedefs = { | |
functions = { | |
zmq_free_fn = { "void", "data", "hint" }, | |
}, | |
structs = { | |
zmq_pollitem_t = "zmq_pollitem_t" | |
}, |
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
--[[ | |
Correctness and benchmark tests of various hamming weight implementations. | |
This is also called "popcount". | |
See also | |
http://lua-users.org/wiki/HammingWeight | |
http://stackoverflow.com/questions/109023/best-algorithm-to-count-the-number-of-set-bits-in-a-32-bit-integer | |
http://www.dalkescientific.com/writings/diary/archive/2008/07/03/hakmem_and_other_popcounts.html | |
http://perso.citi.insa-lyon.fr/claurado/ham/overview.pdf | |
http://chessprogramming.wikispaces.com/Population+Count | |
David Manura, 2012-03. |
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
local sqrt = math.sqrt | |
local huge = math.huge | |
local delta = 1 | |
while delta * delta + 1 ~= 1 do | |
delta = delta * 0.5 | |
end | |
-- vectors ------------------------------------------------------------------- |
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
local sqrt = math.sqrt | |
local huge = math.huge | |
local delta = 1 | |
while delta * delta + 1 ~= 1 do | |
delta = delta * 0.5 | |
end | |
-- vectors ------------------------------------------------------------------- |
OlderNewer