SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
What is new in
Go 1.8
@huazhihao
Agenda
● Language
● Runtime
● Standard Library
● Tool Chain
Language
● Conversion ignoring struct tags
● Alias declaration
Conversion ignoring struct tags
type X struct {
Name string
Num int
}
var Y struct {
Name string `json:"name"`
Num int `json:"num"`
}
Alias declaration
type Foo => pkg.Bar
An alternate syntax in 1.9 ?
AliasSpec = identifier "=>" PackageName "." identifier .
const C => pkg.C
type T => pkg.T
var V => pkg.V
func F => pkg.F
Runtime
● gc pause (< 1ms)
● build (15% speedup)
● defer (10%-35% speedup)
● cgo (45% speedup)
GC pause down to 1ms
1.6 40ms
1.5 300ms
STW Stack Rescanning
Replaced by a hybrid write barrier combines:
● a Yuasa-style deletion write barrier
● a Dijkstra-style insertion write barrier
An improved implementation of write barrier merged in dev branch reduces the gc
pause reliably to 100µs(GOMAXPROCS=12).
ARM SSA Support
SSA(Static single assignment) form is widely used in modern compilers
Go didn’t have an SSA representation in its internals because it's derived from an
old C compiler which predated SSA.
SSA was introduced into the x86/64 platforms in Go 1.7 and immediately made
● 5–35% speedup
● 20–30% reduction in binary size
Static single assignment form in 1 minute
y = 1
y = 2
x = y
↓
y1 = 1
y2 = 2
x1 = y2
Benefits
● constant propagation
● value range propagation
● sparse conditional constant propagation
● dead code elimination
● global value numbering
● partial redundancy elimination
● strength reduction
● register allocation
Compile speed comparison
Faster defer
(µs)
Faster cgo
ns/op
Standard Library
● HTTP Graceful Shutdown
● HTTP2 Server Push
● TLS Additions
● SQL Additions
● Inline Slice Sorting
● Import path of context
HTTP Graceful Shutdown
quit := make(chan os.Signal)
signal.Notify(quit, os.Interrupt)
srv := &http.Server{Addr: ":8080", Handler: http.DefaultServeMux}
go func() {
<-quit
log.Println("Shutting down server...")
if err := srv.Shutdown(context.Background()); err != nil {
log.Fatalf("could not shutdown: %v", err)
}
}()
HTTP2 Server Push
http.Handle("/static", http.FileServer(http.Dir("./static")))
http.HandleFunc("/index.html",
func(w http.ResponseWriter, r *http.Request) {
if p, ok := w.(http.Pusher); ok {
p.Push("/static/style.css", nil)
p.Push("/static/image.png", nil)
}
w.Header().Set("Content-Type", "text/html")
w.Write([]byte(`
<link href="/static/style.css" rel="stylesheet" />
<img src="/static/image.png" />`))
})
http.ListenAndServeTLS(":4430", "cert.pem", "key.pem", nil)
Stream Frame
/static/style.css PUSH_PROMISE
/static/image.png PUSH_PROMISE
/index.html HEADERS
/index.html DATA
/static/style.css HEADERS
/static/style.css DATA
/static/image.png HEADERS
/static/image.png DATA
TLS Additions
● Support for ChaCha20-Poly1305 based cipher suites
● CipherSuites automatically selected based on hardware support availability if
not specified
● More flexible config APIs
SQL Additions
● Cancelable queries
ctx, cancel := context.WithCancel(context.Background())
● Visible database types
type RowsColumnTypeDatabaseTypeName interface {
Rows
ColumnTypeDatabaseTypeName(index int) string
}
● Multiple result sets
rows.NextResultSet()
● Ping can hit server
Conn.Ping() or Conn.PingContext(ctx)
● Named parameters
sql.Named("Name", value)
● Transaction isolation
BeginTx(ctx context.Context, opts *TxOptions)
Inline Slice Sorting
sort.Sort:
type ByKey []Item
func (items ByKey) Len() int { …
//Len implementation
}
func (items ByKey) Swap(i, j int) { ...
//Swap implementation
}
func (items ByKey) Less(i, j int) bool { …
//Less implementation
}
sort.Sort(ByKey(items))
sort.Slice:
sort.Slice(items, func(i, j int) bool {
//Less implementation
})
Sorting Benchmark
Import path of context
-import "golang.org/x/net/context"
+import "context"
Fix the import by running below on your code base:
# dry run
go tool fix -diff -force=context PATH
# overwrite
go tool fix -force=context PATH
Tool Chain
● Plugins (Shared libraries)
● Default GOPATH
● go bug
● Smarter go vet
Plugins (Shared libraries)
plugin.go:
package shared
import "fmt"
var V int
func F() { fmt.Printf("Hello, number %dn", V) }
main.go:
package main
import "plugin"
func main() {
p, err := plugin.Open("plugin.so")
v, err := p.Lookup("V")
f, err := p.Lookup("F")
*v.(*int) = 7
f.(func())() // prints "Hello, number 7"
}
plugin.so:
$ go build -buildmode=plugin plugin.go
Default GOPATH
When GOPATH is not defined, the runtime will use:
● $HOME/go on Unix
● %USERPROFILE%go on Windows
go bug
The easiest way to file a new issue:
Run `go bug`
Your browser will open https://github.com/golang/go/issues/new with system
details prefilled
Smarter go vet
package main
import (
"io"
"log"
"net/http"
"os"
)
func main() {
res, err := http.Get("https://golang.org")
defer res.Body.Close()
if err != nil {
log.Fatal(err)
}
io.Copy(os.Stdout, res.Body)
}
Thank you
i@huazhihao.com

Mais conteúdo relacionado

Mais procurados

Fluentd v0.12 master guide
Fluentd v0.12 master guideFluentd v0.12 master guide
Fluentd v0.12 master guideN Masahiro
 
VCLをTDDで書いてデプロイする
VCLをTDDで書いてデプロイするVCLをTDDで書いてデプロイする
VCLをTDDで書いてデプロイするKengo HAMASAKI
 
Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)Sneha Inguva
 
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Zabbix
 
Weave Networking on Docker
Weave Networking on DockerWeave Networking on Docker
Weave Networking on DockerStylight
 
Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet ShieldTinker
 
LXC on Ganeti
LXC on GanetiLXC on Ganeti
LXC on Ganetikawamuray
 
WebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonWebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonGeert Van Pamel
 
Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016Jian-Hong Pan
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with phpElizabeth Smith
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVSsnrism
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerVladimir Sedach
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filterGiovanni Bechis
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgKenny (netman)
 
SCaLE 2016 - syslog-ng: From Raw Data to Big Data
SCaLE 2016 - syslog-ng: From Raw Data to Big DataSCaLE 2016 - syslog-ng: From Raw Data to Big Data
SCaLE 2016 - syslog-ng: From Raw Data to Big DataBalaBit
 

Mais procurados (20)

Fluentd v0.12 master guide
Fluentd v0.12 master guideFluentd v0.12 master guide
Fluentd v0.12 master guide
 
gRPC in Go
gRPC in GogRPC in Go
gRPC in Go
 
VCLをTDDで書いてデプロイする
VCLをTDDで書いてデプロイするVCLをTDDで書いてデプロイする
VCLをTDDで書いてデプロイする
 
Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)
 
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
 
Weave Networking on Docker
Weave Networking on DockerWeave Networking on Docker
Weave Networking on Docker
 
The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
 
Ethernet Shield
Ethernet ShieldEthernet Shield
Ethernet Shield
 
LXC on Ganeti
LXC on GanetiLXC on Ganeti
LXC on Ganeti
 
Fluentd meetup
Fluentd meetupFluentd meetup
Fluentd meetup
 
WebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemonWebTalk - Implementing Web Services with a dedicated Java daemon
WebTalk - Implementing Web Services with a dedicated Java daemon
 
Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016Micro HTTP Server Implemented in C @ COSCUP 2016
Micro HTTP Server Implemented in C @ COSCUP 2016
 
Haproxy - zastosowania
Haproxy - zastosowaniaHaproxy - zastosowania
Haproxy - zastosowania
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
 
Fluentd introduction at ipros
Fluentd introduction at iprosFluentd introduction at ipros
Fluentd introduction at ipros
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
SCaLE 2016 - syslog-ng: From Raw Data to Big Data
SCaLE 2016 - syslog-ng: From Raw Data to Big DataSCaLE 2016 - syslog-ng: From Raw Data to Big Data
SCaLE 2016 - syslog-ng: From Raw Data to Big Data
 

Destaque

Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
Go 1.8 'new' networking features
Go 1.8 'new' networking featuresGo 1.8 'new' networking features
Go 1.8 'new' networking featuresstrikr .
 
Europe ai scaleups report 2016
Europe ai scaleups report 2016Europe ai scaleups report 2016
Europe ai scaleups report 2016Omar Mohout
 
Reflection in Go
Reflection in GoReflection in Go
Reflection in Gostrikr .
 
BLE Beacons & You: Breaking the IoT Barrier #MNSearch
BLE Beacons & You: Breaking the IoT Barrier #MNSearchBLE Beacons & You: Breaking the IoT Barrier #MNSearch
BLE Beacons & You: Breaking the IoT Barrier #MNSearchCasey Markee, MBA
 
UDVDivas Social Media Campaign Report
UDVDivas Social Media Campaign ReportUDVDivas Social Media Campaign Report
UDVDivas Social Media Campaign ReportMindShift Interactive
 
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain Security
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain SecurityCustoms-Trade Partnership Against Terrorism (C-TPAT): Supply Chain Security
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain SecurityLivingston International
 
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them WINNERS-at-WORK Pty Ltd
 
pref_lib_tsubame_coffee_0311
pref_lib_tsubame_coffee_0311pref_lib_tsubame_coffee_0311
pref_lib_tsubame_coffee_0311Tairo Hosokai
 
15 Ideas to Promote Events with Social Media
15 Ideas to Promote Events with Social Media15 Ideas to Promote Events with Social Media
15 Ideas to Promote Events with Social MediaMarie Ennis-O'Connor
 
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...Jordi Varela
 
WAI-ARIAの考え方と使い方を整理しよう
WAI-ARIAの考え方と使い方を整理しようWAI-ARIAの考え方と使い方を整理しよう
WAI-ARIAの考え方と使い方を整理しようNozomi Sawada
 
Games for Health分野の研究開発事例
Games for Health分野の研究開発事例Games for Health分野の研究開発事例
Games for Health分野の研究開発事例Toru Fujimoto
 
確率論及統計論輪講 精度より成果
確率論及統計論輪講 精度より成果確率論及統計論輪講 精度より成果
確率論及統計論輪講 精度より成果Kiyoshi Ogawa
 
Looking Beyond the SEO Plugin
Looking Beyond the SEO PluginLooking Beyond the SEO Plugin
Looking Beyond the SEO PluginRebecca Gill
 

Destaque (18)

Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
Go 1.8 'new' networking features
Go 1.8 'new' networking featuresGo 1.8 'new' networking features
Go 1.8 'new' networking features
 
Europe ai scaleups report 2016
Europe ai scaleups report 2016Europe ai scaleups report 2016
Europe ai scaleups report 2016
 
Reflection in Go
Reflection in GoReflection in Go
Reflection in Go
 
File Collaboration, at its best
File Collaboration, at its bestFile Collaboration, at its best
File Collaboration, at its best
 
BLE Beacons & You: Breaking the IoT Barrier #MNSearch
BLE Beacons & You: Breaking the IoT Barrier #MNSearchBLE Beacons & You: Breaking the IoT Barrier #MNSearch
BLE Beacons & You: Breaking the IoT Barrier #MNSearch
 
UDVDivas Social Media Campaign Report
UDVDivas Social Media Campaign ReportUDVDivas Social Media Campaign Report
UDVDivas Social Media Campaign Report
 
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain Security
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain SecurityCustoms-Trade Partnership Against Terrorism (C-TPAT): Supply Chain Security
Customs-Trade Partnership Against Terrorism (C-TPAT): Supply Chain Security
 
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them
The 8 Performance Roadblocks Holding Businesses Back and What to Do About Them
 
pref_lib_tsubame_coffee_0311
pref_lib_tsubame_coffee_0311pref_lib_tsubame_coffee_0311
pref_lib_tsubame_coffee_0311
 
Editorial Honors for Professional Builder
Editorial Honors for Professional BuilderEditorial Honors for Professional Builder
Editorial Honors for Professional Builder
 
15 Ideas to Promote Events with Social Media
15 Ideas to Promote Events with Social Media15 Ideas to Promote Events with Social Media
15 Ideas to Promote Events with Social Media
 
140 years of gender equality
140 years of gender equality140 years of gender equality
140 years of gender equality
 
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...
Posibilidades de avances en Gestión Clínica en el Servicio Murciano de Salud ...
 
WAI-ARIAの考え方と使い方を整理しよう
WAI-ARIAの考え方と使い方を整理しようWAI-ARIAの考え方と使い方を整理しよう
WAI-ARIAの考え方と使い方を整理しよう
 
Games for Health分野の研究開発事例
Games for Health分野の研究開発事例Games for Health分野の研究開発事例
Games for Health分野の研究開発事例
 
確率論及統計論輪講 精度より成果
確率論及統計論輪講 精度より成果確率論及統計論輪講 精度より成果
確率論及統計論輪講 精度より成果
 
Looking Beyond the SEO Plugin
Looking Beyond the SEO PluginLooking Beyond the SEO Plugin
Looking Beyond the SEO Plugin
 

Semelhante a Go 1.8 new features including faster GC, SSA, HTTP/2 push and more

REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Javaelliando dias
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰KAI CHU CHUNG
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoRodolfo Carvalho
 
Protobuf & Code Generation + Go-Kit
Protobuf & Code Generation + Go-KitProtobuf & Code Generation + Go-Kit
Protobuf & Code Generation + Go-KitManfred Touron
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeKAI CHU CHUNG
 
TDC2018SP | Trilha Go - Processando analise genetica em background com Go
TDC2018SP | Trilha Go - Processando analise genetica em background com GoTDC2018SP | Trilha Go - Processando analise genetica em background com Go
TDC2018SP | Trilha Go - Processando analise genetica em background com Gotdc-globalcode
 
Building Go Web Apps
Building Go Web AppsBuilding Go Web Apps
Building Go Web AppsMark
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Ngoc Dao
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)Ajay Khatri
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and MonoidsHugo Gävert
 
Cape Cod Web Technology Meetup - 2
Cape Cod Web Technology Meetup - 2Cape Cod Web Technology Meetup - 2
Cape Cod Web Technology Meetup - 2Asher Martin
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part AKazuchika Sekiya
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 

Semelhante a Go 1.8 new features including faster GC, SSA, HTTP/2 push and more (20)

REST made simple with Java
REST made simple with JavaREST made simple with Java
REST made simple with Java
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Protobuf & Code Generation + Go-Kit
Protobuf & Code Generation + Go-KitProtobuf & Code Generation + Go-Kit
Protobuf & Code Generation + Go-Kit
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
 
TDC2018SP | Trilha Go - Processando analise genetica em background com Go
TDC2018SP | Trilha Go - Processando analise genetica em background com GoTDC2018SP | Trilha Go - Processando analise genetica em background com Go
TDC2018SP | Trilha Go - Processando analise genetica em background com Go
 
Building Go Web Apps
Building Go Web AppsBuilding Go Web Apps
Building Go Web Apps
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
cq_cxf_integration
cq_cxf_integrationcq_cxf_integration
cq_cxf_integration
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Azure F#unctions
Azure F#unctionsAzure F#unctions
Azure F#unctions
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 
Lobos Introduction
Lobos IntroductionLobos Introduction
Lobos Introduction
 
Cape Cod Web Technology Meetup - 2
Cape Cod Web Technology Meetup - 2Cape Cod Web Technology Meetup - 2
Cape Cod Web Technology Meetup - 2
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part A
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 

Último

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Último (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Go 1.8 new features including faster GC, SSA, HTTP/2 push and more

  • 1. What is new in Go 1.8 @huazhihao
  • 2. Agenda ● Language ● Runtime ● Standard Library ● Tool Chain
  • 3. Language ● Conversion ignoring struct tags ● Alias declaration
  • 4. Conversion ignoring struct tags type X struct { Name string Num int } var Y struct { Name string `json:"name"` Num int `json:"num"` }
  • 5. Alias declaration type Foo => pkg.Bar An alternate syntax in 1.9 ? AliasSpec = identifier "=>" PackageName "." identifier . const C => pkg.C type T => pkg.T var V => pkg.V func F => pkg.F
  • 6. Runtime ● gc pause (< 1ms) ● build (15% speedup) ● defer (10%-35% speedup) ● cgo (45% speedup)
  • 7. GC pause down to 1ms 1.6 40ms 1.5 300ms
  • 8. STW Stack Rescanning Replaced by a hybrid write barrier combines: ● a Yuasa-style deletion write barrier ● a Dijkstra-style insertion write barrier An improved implementation of write barrier merged in dev branch reduces the gc pause reliably to 100µs(GOMAXPROCS=12).
  • 9. ARM SSA Support SSA(Static single assignment) form is widely used in modern compilers Go didn’t have an SSA representation in its internals because it's derived from an old C compiler which predated SSA. SSA was introduced into the x86/64 platforms in Go 1.7 and immediately made ● 5–35% speedup ● 20–30% reduction in binary size
  • 10. Static single assignment form in 1 minute y = 1 y = 2 x = y ↓ y1 = 1 y2 = 2 x1 = y2 Benefits ● constant propagation ● value range propagation ● sparse conditional constant propagation ● dead code elimination ● global value numbering ● partial redundancy elimination ● strength reduction ● register allocation
  • 14. Standard Library ● HTTP Graceful Shutdown ● HTTP2 Server Push ● TLS Additions ● SQL Additions ● Inline Slice Sorting ● Import path of context
  • 15. HTTP Graceful Shutdown quit := make(chan os.Signal) signal.Notify(quit, os.Interrupt) srv := &http.Server{Addr: ":8080", Handler: http.DefaultServeMux} go func() { <-quit log.Println("Shutting down server...") if err := srv.Shutdown(context.Background()); err != nil { log.Fatalf("could not shutdown: %v", err) } }()
  • 16. HTTP2 Server Push http.Handle("/static", http.FileServer(http.Dir("./static"))) http.HandleFunc("/index.html", func(w http.ResponseWriter, r *http.Request) { if p, ok := w.(http.Pusher); ok { p.Push("/static/style.css", nil) p.Push("/static/image.png", nil) } w.Header().Set("Content-Type", "text/html") w.Write([]byte(` <link href="/static/style.css" rel="stylesheet" /> <img src="/static/image.png" />`)) }) http.ListenAndServeTLS(":4430", "cert.pem", "key.pem", nil) Stream Frame /static/style.css PUSH_PROMISE /static/image.png PUSH_PROMISE /index.html HEADERS /index.html DATA /static/style.css HEADERS /static/style.css DATA /static/image.png HEADERS /static/image.png DATA
  • 17. TLS Additions ● Support for ChaCha20-Poly1305 based cipher suites ● CipherSuites automatically selected based on hardware support availability if not specified ● More flexible config APIs
  • 18. SQL Additions ● Cancelable queries ctx, cancel := context.WithCancel(context.Background()) ● Visible database types type RowsColumnTypeDatabaseTypeName interface { Rows ColumnTypeDatabaseTypeName(index int) string } ● Multiple result sets rows.NextResultSet() ● Ping can hit server Conn.Ping() or Conn.PingContext(ctx) ● Named parameters sql.Named("Name", value) ● Transaction isolation BeginTx(ctx context.Context, opts *TxOptions)
  • 19. Inline Slice Sorting sort.Sort: type ByKey []Item func (items ByKey) Len() int { … //Len implementation } func (items ByKey) Swap(i, j int) { ... //Swap implementation } func (items ByKey) Less(i, j int) bool { … //Less implementation } sort.Sort(ByKey(items)) sort.Slice: sort.Slice(items, func(i, j int) bool { //Less implementation })
  • 21. Import path of context -import "golang.org/x/net/context" +import "context" Fix the import by running below on your code base: # dry run go tool fix -diff -force=context PATH # overwrite go tool fix -force=context PATH
  • 22. Tool Chain ● Plugins (Shared libraries) ● Default GOPATH ● go bug ● Smarter go vet
  • 23. Plugins (Shared libraries) plugin.go: package shared import "fmt" var V int func F() { fmt.Printf("Hello, number %dn", V) } main.go: package main import "plugin" func main() { p, err := plugin.Open("plugin.so") v, err := p.Lookup("V") f, err := p.Lookup("F") *v.(*int) = 7 f.(func())() // prints "Hello, number 7" } plugin.so: $ go build -buildmode=plugin plugin.go
  • 24. Default GOPATH When GOPATH is not defined, the runtime will use: ● $HOME/go on Unix ● %USERPROFILE%go on Windows
  • 25. go bug The easiest way to file a new issue: Run `go bug` Your browser will open https://github.com/golang/go/issues/new with system details prefilled
  • 26. Smarter go vet package main import ( "io" "log" "net/http" "os" ) func main() { res, err := http.Get("https://golang.org") defer res.Body.Close() if err != nil { log.Fatal(err) } io.Copy(os.Stdout, res.Body) }