Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #13879 > unrolled thread
| Started by | Branimir Maksimovic <branimir.maksimovic@gmail.com> |
|---|---|
| First post | 2021-09-25 12:19 +0000 |
| Last post | 2021-09-25 19:16 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.programming
Dilemma Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 12:19 +0000
Re: Dilemma Peter <peterxpercival@hotmail.com> - 2021-09-25 19:39 +0100
Re: Dilemma Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 19:16 +0000
| From | Branimir Maksimovic <branimir.maksimovic@gmail.com> |
|---|---|
| Date | 2021-09-25 12:19 +0000 |
| Subject | Dilemma |
| Message-ID | <ttE3J.44939$3p3.30652@fx16.iad> |
Let’s compare:
1000 parallel connections 100k requests
yesod :
7658 recs/sec
Errors 85808
Timeouted 0
Mine::
12699 recs/sec
Errors 0
Timeouted 0
10k connections, 100k requests:
yesod:
5205 recs/sec
Errors 81152
Timeouted 3842
Mine:
8160 recs/sec
Errors 0
Timeouted 46
Sources:
Yesod:
/ HomeR GET
|]
instance Yesod HelloWorld
getHomeR :: Handler ()
getHomeR = do
number <- liftIO (randomIO :: IO Float)
let txt = pack $ "hello world " ++ show number
sendResponse (txt:: Text)
main :: IO ()
main = warp 3838 HelloWorld
Mine:
import Sockets
import Foreign.C.String
import Data.IORef
import Control.Concurrent
main = do
ref <- newIORef 1
s <- socket defaultCallbacks {
constructor = \ci -> set_cb ci defaultCallbacks {
done_connected = binded ref,
done_reading = process
}
}
pl <- epoll 1000
pl1 <- epoll 1000
pl2 <- epoll 1000
pl3 <- epoll 1000
listen s "8080"
pl_accept pl s
pl_accept pl1 s
pl_accept pl2 s
pl_accept pl3 s
let run pl = do forkIO $
run_loop pl (-1)
run pl
run pl1
run pl2
run_loop pl3 (-1)
binded ref pl s = do
i <- readIORef ref
putStrLn $ "connection nr:"++show i
writeIORef ref (i+1)
pl_read pl s
return 0
process pl s buf len = do
str <- peekCStringLen (buf,fromIntegral len)
ip <- client s
str1 <- peekCString ip
putStrLn $ "from "++str1++" \ngot "++str
write pl s "Hello World!!!\r\n"
return 0
if using -threaded performance is *worse*.
Dilemma:
It is mine lib for https://www.volomp.com
I work now here https://www.rt-rk.com
on this http://www.vti.mod.gov.rs/index.php?view=actuality&type=projects&category=1&id=72
I guess that if I port it to Haskell purely from CPP, I won’t have problems with copyright?
Greetings, Branimir
--
7-77-777
Evil Sinner!
[toc] | [next] | [standalone]
| From | Peter <peterxpercival@hotmail.com> |
|---|---|
| Date | 2021-09-25 19:39 +0100 |
| Message-ID | <sinqd5$13js$1@gioia.aioe.org> |
| In reply to | #13879 |
Branimir Maksimovic wrote: > [...] > > Dilemma: You need to be told what a dilemma is. If you must take one of two courses of action and both of them bring an unpleasant consequence, then you face a dilemma. "Dilemma" _doesn't_ mean "problem in some vague sense". I've even come across "dilemma" being used as if it just means "question". > It is mine lib for https://www.volomp.com > I work now here https://www.rt-rk.com > on this http://www.vti.mod.gov.rs/index.php?view=actuality&type=projects&category=1&id=72 > > I guess that if I port it to Haskell purely from CPP, I won’t have problems with copyright? > > Greetings, Branimir > > > > -- The world will little note, nor long remember what we say here Abraham Lincoln at Gettysburg
[toc] | [prev] | [next] | [standalone]
| From | Branimir Maksimovic <branimir.maksimovic@gmail.com> |
|---|---|
| Date | 2021-09-25 19:16 +0000 |
| Message-ID | <9AK3J.79856$Dr.20688@fx40.iad> |
| In reply to | #13882 |
On 2021-09-25, Peter <peterxpercival@hotmail.com> wrote: > Branimir Maksimovic wrote: >> [...] >> >> Dilemma: > > You need to be told what a dilemma is. If you must take one of two > courses of action and both of them bring an unpleasant consequence, then > you face a dilemma. "Dilemma" _doesn't_ mean "problem in some vague > sense". I've even come across "dilemma" being used as if it just means > "question". > > Question, yes. But I already released it in public in Rust form :P https://github.com/bmaxa/web_server_rust :P It's just that I want to port it to several languages. Full web server can anyone complete :p -- 7-77-777 Evil Sinner!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web