Search Results

Search found 6 results on 1 pages for 'drakosha'.

Page 1/1 | 1 

  • How can i estimate memory usage of stl::map?

    - by Drakosha
    For example, I have a std::map with known sizeof(A) and sizefo(B), while map has N entries inside. How would you estimate its memory usage? I'd say it's something like (sizeof(A) + sizeof(B)) * N * factor But what is the factor? Different formula maybe? Update: Maybe it's easier to ask for upper bound?

    Read the article

  • aio_write on linux with rtkaio is sometimes long

    - by Drakosha
    I'm using async io on linux with rtkaio library. In my tests everything works perfectly, but, in my real application i see that aio_write which is supposed to return very fast, is very slow. It can take more than 100 milis to write a 128KB to a O_DIRECT padded file. Both my test and the application use same I/O size, i check on the same file system (GFS). I added counting and i see that there are about 50% of async io operations that are short (shorter then 2 milis) and 50% that are long (longer than 2 milis). I also checked that the test and the application both use the same rtkaio library. I'm pretty lost, anyone any ideas where should i look? Another my related question: http://stackoverflow.com/questions/1799537/proc-sys-fs-aio-nr-is-never-higher-than-1024-aio-on-linux

    Read the article

  • strange error in haskell about indentation of if-then-else

    - by Drakosha
    I have the following code: foo :: Int -> [String] -> [(FilePath, Integer)] -> IO Int foo _ [] _ = return 4 foo _ _ [] = return 5 foo n nameREs pretendentFilesWithSizes = do result <- (bar n (head nameREs) pretendentFilesWithSizes) if result == 0 then return 0 -- <========================================== here is the error else foo n (tail nameREs) pretendentFilesWithSizes I get an error on the line with the comment above, the error is: aaa.hs:56:2: parse error (possibly incorrect indentation) I'm working with emacs, there's no spaces, and i do not understand what did i do wrong.

    Read the article

  • how to raise warning if return value is disregarded - gcc or static code check?

    - by Drakosha
    I'd like to see all the places in my code (C++) which disregard return value of a function. How can I do it - with gcc or static code analysis tool? Bad code example: int f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int i = 7; f(i); ///// <<----- here I disregard the return value return 1; } Update: it should work even if the function and its use are in different files free static check tool

    Read the article

  • dealing with IO vs pure code in haskell

    - by Drakosha
    I'm writing a shell script (my 1st non-example in haskell) which is supposed to list a directory, get every file size, do some string manipulation (pure code) and then rename some files. I'm not sure what i'm doing wrong, so 2 questions: How should i arrange the code in such program? I have a specific issue, i get the following error, what am i doing wrong? error: Couldn't match expected type [FilePath]' against inferred typeIO [FilePath]' In the second argument of mapM', namelyfileNames' In a stmt of a 'do' expression: files <- (mapM getFileNameAndSize fileNames) In the expression: do { fileNames <- getDirectoryContents; files <- (mapM getFileNameAndSize fileNames); sortBy cmpFilesBySize files } code: getFileNameAndSize fname = do (fname, (withFile fname ReadMode hFileSize)) getFilesWithSizes = do fileNames <- getDirectoryContents files <- (mapM getFileNameAndSize fileNames) sortBy cmpFilesBySize files

    Read the article

1