Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad performance when trying to insert thousands of images into a xlsx file #274

Closed
lianzhao opened this issue Sep 28, 2018 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@lianzhao
Copy link

Description
When I tried to insert thousands of images into a xlsx file, It was very slow...
It took hundreds milliseconds per item.

Steps to reproduce the issue:

package main

import (
	"fmt"
	_ "image/jpeg"
	"log"

	"github.com/360EntSecGroup-Skylar/excelize"
)

func main() {
	xlsx := excelize.NewFile()
	for i := 0; i < 10000; i++ {
		if err := xlsx.AddPicture("Sheet1", fmt.Sprintf("A%d", i+1), "./lena.jpg", ""); err != nil {
			log.Fatalln(err)
		}
		if i%100 == 0 {
			log.Printf("%d done", i)
		}
	}
	if err := xlsx.SaveAs("./Book1.xlsx"); err != nil {
		log.Fatalln(err)
	}
}

Describe the results you received:

...
2018/09/28 22:54:20 4000 done
2018/09/28 22:54:48 4100 done
2018/09/28 22:55:16 4200 done
2018/09/28 22:55:45 4300 done
2018/09/28 22:56:22 4400 done
2018/09/28 22:56:59 4500 done
2018/09/28 22:57:30 4600 done
2018/09/28 22:58:04 4700 done
2018/09/28 22:58:45 4800 done
2018/09/28 22:59:22 4900 done
2018/09/28 22:59:58 5000 done

Describe the results you expected:
Well, better performance?

Output of go version:

go version go1.9.4 darwin/amd64

Excelize version or commit ID:

[[projects]]
  name = "github.com/360EntSecGroup-Skylar/excelize"
  packages = ["."]
  revision = "eb62256d165607c6877ce88efbba10c119137b3d"
  version = "v1.3.0"

Environment details (OS, Microsoft Excel™ version, physical, etc.):

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/lianzhao/work"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3x/fvc3fcrs5139r6g4k36sxl_40000gn/T/go-build268279933=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
@xuri xuri added the enhancement New feature or request label Oct 4, 2018
@xuri xuri closed this as completed in 1aed1d7 Feb 25, 2019
@xuri
Copy link
Member

xuri commented Feb 26, 2019

Hi @lianzhao, thanks for your issue. I have optimized the performance of add images, charts, and shapes.

nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants