Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from efectn/master
Add new guide about speed, add missing config fields
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ⚡ Make Fiber Faster | ||
|
||
## Custom JSON Encoder/Decoder | ||
Since Fiber v2.32.0, we use **encoding/json** as default json library due to stability and producibility. However, the standard library is a bit slow compared to 3rd party libraries. If you're not happy with the performance of **encoding/json**, we recommend you to use these libraries: | ||
- [goccy/go-json](https://github.com/goccy/go-json1) | ||
- [bytedance/sonic](https://github.com/bytedance/sonic) | ||
- [segmentio/encoding](https://github.com/segmentio/encoding) | ||
- [mailru/easyjson](https://github.com/mailru/easyjson) | ||
- [minio/simdjson-go](https://github.com/minio/simdjson-go) | ||
- [wI2L/jettison](https://github.com/wI2L/jettison) | ||
|
||
{% code title="Example" %} | ||
```go | ||
package main | ||
|
||
import "github.com/gofiber/fiber/v2" | ||
import "github.com/goccy/go-json" | ||
|
||
func main() { | ||
app := fiber.New(fiber.Config{ | ||
JSONEncoder: json.Marshal, | ||
JSONDecoder: json.Unmarshal, | ||
}) | ||
|
||
# ... | ||
} | ||
``` | ||
{% endcode %} | ||
|
||
### References | ||
- [Set custom JSON encoder for client](../api/client.md#jsonencoder) | ||
- [Set custom JSON decoder for client](../api/client.md#jsondecoder) | ||
- [Set custom JSON encoder for application](../api/fiber.md#config) | ||
- [Set custom JSON decoder for application](../api/fiber.md#config) |