mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
server: tune ghc unfolding/specialization flags for performance (closes #2610)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2629 GitOrigin-RevId: acb22a595cae672bdf5a0303094fb28fc5afcfb3
This commit is contained in:
parent
9015b354ac
commit
a10ec5c8d8
@ -53,6 +53,7 @@ suffix-less versions. Aliases may be set by both
|
||||
of the invocation will be the same otherwise it will be `NULL`.
|
||||
- server: support `extensions` field in error responses from action webhook endpoints (fix #4001)
|
||||
- server: fix custom-check based permissions for MSSQL (#7429)
|
||||
- server: query performance improvements
|
||||
- server: remove identity notion for table columns (fix #7557)
|
||||
- server: support MSSQL transactions
|
||||
- server: log individual operation details in the http-log during a batch graphQL query execution
|
||||
|
@ -21,6 +21,9 @@ constraints:
|
||||
setup.Cabal <3.4
|
||||
|
||||
package *
|
||||
-- NOTE: this gets applied to both local (hasura) packages and dependencies,
|
||||
-- but optimizations for local hasura packages are overridden/controlled
|
||||
-- via the 'optimize-hasura' flag.
|
||||
optimization: 2
|
||||
-- For tooling, e.g. 'weeder', and IDE-like stuff:
|
||||
ghc-options: -fwrite-ide-info
|
||||
|
@ -11,6 +11,9 @@ package *
|
||||
-- the 16G of available memory.
|
||||
+RTS -M15000m -RTS
|
||||
|
||||
-- Enable optimizations in all local (hasura) packages:
|
||||
flags: +optimize-hasura
|
||||
|
||||
package graphql-engine
|
||||
ghc-options:
|
||||
-Werror
|
||||
@ -28,7 +31,7 @@ package graphql-engine
|
||||
|
||||
package graphql-engine-pro
|
||||
ghc-options:
|
||||
-O2 -Werror
|
||||
-Werror
|
||||
-- Tune for the circleci `2xlarge` resource class, which provides
|
||||
-- 16 vcpus.
|
||||
-j14
|
||||
|
@ -12,12 +12,12 @@ package *
|
||||
-- a massive rebuild. To start, see:
|
||||
-- https://www.haskell.org/ghc/blog/20200403-dwarf-1.html
|
||||
debug-info: 2
|
||||
|
||||
-- NOTE: new-build may report a misleading 'Build profile: -O1'
|
||||
-- See:https://github.com/haskell/cabal/issues/6221
|
||||
flags: -optimize-hasura
|
||||
|
||||
package graphql-engine
|
||||
-- NOTE: this seems to work so long as there is no 'ghc-options: -O2' in the cabal file,
|
||||
-- but new-build will report 'Build profile: -O1' for some reason.
|
||||
-- See:https://github.com/haskell/cabal/issues/6221
|
||||
optimization: 0
|
||||
documentation: false
|
||||
flags: +developer
|
||||
-- NOTE: 'cabal new-build --enable-coverage' seems to rebuild all deps with coverage
|
||||
|
@ -25,16 +25,38 @@ flag profiling
|
||||
default: False
|
||||
manual: True
|
||||
|
||||
-- A single flag to enable all optimization-related settings at once, for all
|
||||
-- hasura code.
|
||||
-- We share this flag name across our .cabal projects so we can switch it on or
|
||||
-- off for all of them at the top level of our cabal.project(.*) files
|
||||
flag optimize-hasura
|
||||
description: Compile hasura code with appropriate optimizations
|
||||
default: True
|
||||
manual: False
|
||||
|
||||
common common-all
|
||||
ghc-options:
|
||||
-fmax-simplifier-iterations=20 -foptimal-applicative-do
|
||||
-foptimal-applicative-do
|
||||
-Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
|
||||
-- This is just to keep compile-times in check and might be adjusted later (See mono #2610):
|
||||
-fmax-simplifier-iterations=2
|
||||
|
||||
if flag(developer)
|
||||
cpp-options: -DDeveloperAPIs
|
||||
if flag(profiling)
|
||||
cpp-options: -DPROFILING
|
||||
|
||||
if flag(optimize-hasura)
|
||||
ghc-options:
|
||||
-- This is for performance, and works in combination with '-fspecialise-aggressively'
|
||||
-- in the graphql-engine 'executable' stanza below, and in any other dependent
|
||||
-- executables (See mono #2610):
|
||||
-fexpose-all-unfoldings
|
||||
-O2
|
||||
else
|
||||
-- we just want to build fast:
|
||||
ghc-options: -O0
|
||||
|
||||
default-language: Haskell2010
|
||||
default-extensions:
|
||||
AllowAmbiguousTypes
|
||||
@ -659,6 +681,12 @@ library
|
||||
|
||||
executable graphql-engine
|
||||
import: common-all, common-exe
|
||||
|
||||
if flag(optimize-hasura)
|
||||
ghc-options:
|
||||
-- This is for performance (See mono #2610):
|
||||
-fspecialise-aggressively
|
||||
|
||||
hs-source-dirs: src-exec
|
||||
main-is: Main.hs
|
||||
build-depends: base
|
||||
|
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
module Main where
|
||||
module Main (main) where
|
||||
|
||||
import Control.Concurrent.Extended qualified as C
|
||||
import Control.Exception
|
||||
|
Loading…
Reference in New Issue
Block a user