<div dir="auto">That would be fun to share ! Look forward to learning what’s different </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 25, 2021 at 3:51 AM Branimir Maksimovic <<a href="mailto:branimir.maksimovic@gmail.com">branimir.maksimovic@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">It is mine lib for <a href="https://www.volomp.com" target="_blank">https://www.volomp.com</a><div>I work now here <a href="https://www.rt-rk.com" target="_blank">https://www.rt-rk.com</a></div><div>on this <a href="http://www.vti.mod.gov.rs/index.php?view=actuality&type=projects&category=1&id=72" target="_blank">http://www.vti.mod.gov.rs/index.php?view=actuality&type=projects&category=1&id=72</a></div><div><br></div><div>I guess that if I port it to Haskell purely from CPP, I won’t have problems with copyright?</div><div><br></div><div>Greetings, Branimir</div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><br><div><br><blockquote type="cite"><div>On 25.09.2021., at 09:22, Branimir Maksimovic <<a href="mailto:branimir.maksimovic@gmail.com" target="_blank">branimir.maksimovic@gmail.com</a>> wrote:</div><br><div><div>Let’s compare:<br>1000 parallel connections 100k requests<br><br>yesod :<br>7658 recs/sec<br>Errors 85808<br>Timeouted 0<br><br>Mine::<br>12699 recs/sec<br>Errors 0<br>Timeouted 0<br><br>10k connections, 100k requests:<br>yesod:<br>5205 recs/sec<br>Errors 81152<br>Timeouted 3842<br><br>Mine:<br>8160 recs/sec<br>Errors 0<br>Timeouted 46<br><br>Sources:<br>Yesod:<br>/ HomeR GET<br>|]<br><br>instance Yesod HelloWorld<br><br>getHomeR :: Handler ()<br>getHomeR = do<br>              number <- liftIO (randomIO :: IO Float)<br>              let txt = pack $ "hello world " ++ show number<br>              sendResponse (txt:: Text)<br><br>main :: IO ()<br>main = warp 3838 HelloWorld<br><br>Mine:<br>import Sockets<br>import Foreign.C.String<br>import Data.IORef<br>import Control.Concurrent<br><br>main = do<br>    ref <- newIORef 1<br>    s <- socket defaultCallbacks {<br>                                    constructor = \ci -> set_cb ci defaultCallbacks {<br>                                        done_connected = binded ref,<br>                                        done_reading = process<br>                                        }<br>                                 }<br>    pl <- epoll 1000<br>    pl1 <- epoll 1000<br>    pl2 <- epoll 1000<br>    pl3 <- epoll 1000<br>    listen s "8080"<br>    pl_accept pl s<br>    pl_accept pl1 s<br>    pl_accept pl2 s<br>    pl_accept pl3 s<br>    let run pl = do forkIO $<br>                     run_loop pl (-1)<br>    run pl<br>    run pl1<br>    run pl2<br>    run_loop pl3 (-1)<br><br>binded ref pl s = do<br>    i <- readIORef ref<br>    putStrLn $ "connection nr:"++show i<br>    writeIORef ref (i+1)<br>    pl_read pl s<br>    return 0<br><br>process pl s buf len = do<br>        str <- peekCStringLen (buf,fromIntegral len)<br>        ip <- client s<br>        str1 <- peekCString ip<br>        putStrLn $ "from "++str1++" \ngot "++str<br>        write pl s "Hello World!!!\r\n"<br>        return 0<br><br>if using -threaded performance is *worse*.<br><br>Greetings, Branimir.</div></div></blockquote></div><br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div>