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
module Main where | |
import Utils | |
import Control.Concurrent | |
import Control.Concurrent.Chan | |
import Data.List | |
import qualified Data.Map.Strict as M | |
import qualified Data.Set as S | |
import Data.Range as Range |
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
{-# LANGUAGE OverloadedStrings, DeriveGeneric, DerivingStrategies, DeriveAnyClass #-} | |
module Main where | |
import Prelude hiding (foldl) | |
import Conduit hiding (connect) | |
import Data.Attoparsec.ByteString as Attoparsec | |
import Data.Attoparsec.ByteString.Char8 | |
import qualified Data.ByteString as B | |
import Data.Aeson | |
import Data.Conduit.Attoparsec |
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
// Extremely hacky server program that will send a standard response | |
// to every client that connects, then closes the connection. Will | |
// issue no system calls (as measured by `strace`) after initial setup | |
// no matter how many requests are served. | |
// Yes, this program is sorely lacking in error checking. It's a toy | |
// and not meant to be taken seriously. | |
// compile with gcc no_syscall_server.c -luring |
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
-- To benchmark, make sure to expose the GHC.Event.* in /libraries/base/base.cabal, | |
-- otherwise GHC will complain that they are hidden modules. | |
import GHC.Event.Manager hiding (closeFd) | |
import GHC.Event.Internal | |
import GHC.Event.IoUring as IoUring | |
import GHC.Event.EPoll as Epoll | |
import Control.Monad | |
import Data.Time | |
import System.Posix.IO |
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
{-# LANGUAGE OverloadedStrings, BangPatterns, GeneralizedNewtypeDeriving, CPP #-} | |
module Main where | |
#include <sys/epoll.h> | |
import Foreign.C.Error (eNOENT, getErrno, throwErrno, | |
throwErrnoIfMinus1, throwErrnoIfMinus1_) | |
import Foreign.C.Types | |
import Foreign.Marshal hiding (void, newArray) |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Foreign.C.Types | |
import System.Posix.IO | |
import System.Posix.Types | |
import System.Linux.IO.URing | |
import System.Linux.IO.URing.PollEvent |
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
(gdb) x/80a 0x42009ffe28-80 | |
0x42009ffdd8: 0x2d68 0x718018 <base_GHCziEventziPSQ_zdwunsafeInsertNew_info+2408> | |
0x42009ffde8: 0x42003216b1 0x8 | |
0x42009ffdf8: 0x4200613ed9 0x7899c0 <ghczmbignum_GHCziNumziInteger_integerToWordzh_info+48> | |
0x42009ffe08: 0x769528 <base_GHCziEventziIoUring_zdwconstructUserdata_info+816> 0x0 | |
0x42009ffe18: 0x1 0x825fd0 <stg_ret_p_info> | |
0x42009ffe28: 0x7ffff45e0940 0x75e7c8 <base_SystemziLinuxziIOziURingziRing_zdwpushSqe_info+264> | |
0x42009ffe38: 0x7ffff45dc040 0x7ffff45dc100 | |
0x42009ffe48: 0x7ffff45e0940 0xa19 | |
0x42009ffe58: 0x1ff 0xa19 |
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
(gdb) bt | |
#0 LOOKS_LIKE_CLOSURE_PTR (p=0x318) | |
at includes/rts/storage/ClosureMacros.h:255 | |
#1 0x0000000000a044e6 in evacuate (p=0x420193ce48) at rts/sm/Evac.c:591 | |
#2 0x0000000000a14ddb in scavenge_small_bitmap (p=0x420193ce48, size=1, | |
bitmap=0) at rts/sm/Scav.c:289 | |
#3 0x0000000000a17692 in scavenge_stack (p=0x420193ce48, | |
stack_end=0x420193cf80) at rts/sm/Scav.c:1923 | |
#4 0x0000000000a16e15 in scavenge_one (p=0x420193cbf8) at rts/sm/Scav.c:1484 | |
#5 0x0000000000a17218 in scavenge_mutable_list (bd=0x4201500880, gen=0xcb88e0) |
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
{-# LANGUAGE OverloadedStrings #-} | |
-- Echo server program | |
module Main (main) where | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
import qualified Control.Exception as E | |
import Control.Monad (unless, forever, void) | |
import qualified Data.ByteString as S | |
import qualified Data.ByteString.Char8 as S8 |
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
# See https://wjwh.eu/posts/2019-07-21-static-crystal-images.html for the reasoning behind each line | |
# Build stage | |
FROM durosoft/crystal-alpine:0.28.0 as build | |
COPY shard.yml shard.yml | |
RUN shards install --production | |
COPY . ./ | |
RUN crystal build src/my_app.cr --release --static |
NewerOlder