In view of the shortcomings such as slow search speed, low optimization precision and premature convergence of artificial hummingbird algorithm, an enhanced artificial hummingbird algorithm based on golden sine factor named DGSAHA is proposed. Firstly, chaos mapping is used to generate the initial candidate solution to increase the diversity of the population, which lays the foundation for the global search. Then, perturb the individuals by means of the differential variation between individuals on the group, thereby enhancing the diversity of the population, preserving the excellent individuals, eliminating the inferior individuals, and guiding the search process to approach the global optimal solution, avoiding the phenomenon of premature convergence. Finally, the golden sine factor were introduced in the guided foraging stage is conducive to the full exploration of the global optimal solution, reducing the search space for individuals to approach the optimal solution. And, it facilitates the balance between “exploration” and “exploitation” of algorithm. Thereby, the accuracy and speed of the DGSAHA can be improved to a certain extent. 25 classic functions, the CEC2014 and CEC2019 benchmark functions were tested, and several representative meta-heuristic algorithms and its improved algorithm are compared for evaluate the validity of DGSAHA. Meanwhile, the dimensional scalability of the variable-dimensional test function is discussed. The results of non-parametric statistical analysis and performance index show that DGSAHA in this paper has better comprehensive optimization performance, significantly improves the search speed and convergence precision, and has strong ability to get rid of the local optimal solution. Finally, the performance of DGSAHA and the practicability of truss structure are answered by three engineering examples of plane and space truss topology optimization problem. This optimization problem considers not only the static constraints such as stress, displacement and buckling, but also the dynamic constraints of frequency and motion stability. In order to avoid singularity and unnecessary analysis, the stiffness, mass and load matrices are reconstructed in finite element analysis. A lighter truss structure than the existing solution is obtained. The validity, extensibility and practicability of the algorithm are further illustrated.